From: Petr Vorel <pvorel@suse.cz>
To: Li Wang <liwang@redhat.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] swapon01: swapon01: prevent OOM happening in swap process
Date: Tue, 19 Mar 2024 20:24:22 +0100 [thread overview]
Message-ID: <20240319192422.GB424358@pevik> (raw)
In-Reply-To: <CAEemH2etj26fEXV7jk3jC=RcU=v18qDpkskhVOr8bDW5Fma4vQ@mail.gmail.com>
> On Tue, Mar 19, 2024 at 1:43 PM Li Wang <liwang@redhat.com> wrote:
> > On Tue, Mar 19, 2024 at 1:04 PM Petr Vorel <pvorel@suse.cz> wrote:
> >> > On Mon, Mar 18, 2024 at 8:40 PM Wei Gao <wegao@suse.com> wrote:
> >> > > > That's because the available swapfile on your SUT is too small,
> >> > > > you can adjust it (then retest it) by yourself to find a proper
> >> size.
> >> > > > This is fine as long as the swapfile size is less than 300MB,
> >> > > > otherwise we need to set .dev_min_size like what we did
> >> > > > for swapoff01.c.
> >> > > > And, on the other side, we can't guarantee the system SwapCached
> >> > > > happened every time, it depends on the system's configuration.
> >> > > 100M is good enough for current system, could you help check following
> >> > > patch?
> >> > Can we rewrite the make_swapfile() API to support passing MB size for
> >> > making the swapfile?
> >> I guess it would be desirable (but keep also possible to pass that 10
> >> blocks,
> >> therefore maybe use flag to distinguish between MB and blocks?).
> > That's fine but a bit complex for users to distinguish flags.
> > Or, what about making the function use the flag as static, and
> > export two additional functions with MB and blocks?
> > enum swapfile_method {
> > SWAPFILE_BY_SIZE,
> > SWAPFILE_BY_BLOCKS
> > };
> > static int make_swapfile(const char *swapfile, unsigned int para, int
> > safe, enum swapfile_method method) {
> > // The main logic to achieve the swapfile-making process
> > // ...
> > }
> > int make_swapfile_size(const char *swapfile, unsigned int size, int safe) {
> > return make_swapfile(swapfile, size, safe, SWAPFILE_BY_SIZE);
> > }
> > int make_swapfile_blks(const char *swapfile, unsigned int blocks, int
> > safe) {
> > return make_swapfile(swapfile, blocks, safe, SWAPFILE_BY_BLOCKS);
> > }
> Even simpler to define two macros with one make_swapfile():
> #define MAKE_SWAPFILE_SIZE(swapfile, size, safe) \
> make_swapfile(swapfile, size, safe, SWAPFILE_BY_SIZE)
> #define MAKE_SWAPFILE_BLKS(swapfile, blocks, safe) \
> make_swapfile(swapfile, blocks, safe, SWAPFILE_BY_BLOCKS)
+1
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2024-03-19 19:24 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-14 1:33 [LTP] [PATCH v1] swapon01.c: Apply a margin to avoid oom Wei Gao via ltp
2024-03-14 6:40 ` Li Wang
2024-03-15 1:30 ` Wei Gao via ltp
2024-03-15 3:17 ` Li Wang
2024-03-15 3:44 ` Wei Gao via ltp
2024-03-15 4:09 ` Li Wang
2024-03-15 4:19 ` Li Wang
2024-03-15 5:24 ` Wei Gao via ltp
2024-03-15 5:56 ` Li Wang
2024-03-15 6:24 ` [LTP] [PATCH] swapon01: swapon01: prevent OOM happening in swap process Li Wang
2024-03-15 7:44 ` Wei Gao via ltp
2024-03-15 8:36 ` Li Wang
2024-03-15 10:52 ` Wei Gao via ltp
2024-03-17 9:52 ` Li Wang
2024-03-18 3:20 ` Wei Gao via ltp
2024-03-18 6:32 ` Li Wang
2024-03-18 7:02 ` Wei Gao via ltp
2024-03-18 7:26 ` Li Wang
2024-03-18 12:39 ` Wei Gao via ltp
2024-03-19 3:28 ` Li Wang
2024-03-19 5:03 ` Petr Vorel
2024-03-19 5:43 ` Li Wang
2024-03-19 5:51 ` Li Wang
2024-03-19 7:29 ` Wei Gao via ltp
2024-03-19 8:18 ` Li Wang
2024-03-19 9:20 ` Wei Gao via ltp
2024-03-19 19:24 ` Petr Vorel [this message]
2024-03-19 19:23 ` Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240319192422.GB424358@pevik \
--to=pvorel@suse.cz \
--cc=liwang@redhat.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).