All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Yang Xu <xuyang2018.jy@fujitsu.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2 3/7] syscalls/swapon03: use get_maxswapfiles() and GET_USED_SWAPFILES() api
Date: Wed, 3 Jan 2024 16:34:35 +0100	[thread overview]
Message-ID: <ZZV-i5pZ-SNdFT5b@yuki> (raw)
In-Reply-To: <20231222050006.148845-3-xuyang2018.jy@fujitsu.com>

Hi!
> +	max_swapfiles = (int)get_maxswapfiles();

We may as well declare the get_maxswapfiles() to return int instead,
it's not going to overflow signed int anytime soon...

> +	used_swapfiles = GET_USED_SWAPFILES();
> +	swapfiles = max_swapfiles - used_swapfiles;
> +	if (swapfiles > max_swapfiles)
> +		swapfiles = max_swapfiles;
>  	pid = SAFE_FORK();
>  	if (pid == 0) {
>  		/*create and turn on remaining swapfiles */
> -- 
> 2.27.0
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2024-01-03 15:34 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-05  6:16 [LTP] [PATCH 1/3] libltpswap: Add get_maxswapfiles api Yang Xu
2023-12-05  6:16 ` [LTP] [PATCH 2/3] syscalls/swapon03: Use get_maxswapfiles() api instead of hard code Yang Xu
2023-12-22  1:39   ` Yang Xu (Fujitsu)
2023-12-22 11:42     ` Petr Vorel
2023-12-05  6:16 ` [LTP] [PATCH 3/3] swaponoff.h: Remove useless header Yang Xu
2023-12-22  5:00   ` [LTP] [PATCH v2 1/7] libltpswap: Add get_maxswapfiles api Yang Xu
2023-12-22  5:00     ` [LTP] [PATCH v2 2/7] libltpswap: alter get_used_swapfiles api Yang Xu
2024-01-03 15:30       ` Cyril Hrubis
2023-12-22  5:00     ` [LTP] [PATCH v2 3/7] syscalls/swapon03: use get_maxswapfiles() and GET_USED_SWAPFILES() api Yang Xu
2024-01-03 15:34       ` Cyril Hrubis [this message]
2023-12-22  5:00     ` [LTP] [PATCH v2 4/7] swaponoff.h: Remove useless header Yang Xu
2023-12-22  5:00     ` [LTP] [PATCH v2 5/7] swapon/Makefile: Remove useless section for MAX_SWAPFILES Yang Xu
2024-01-03 15:40       ` Cyril Hrubis
2023-12-22  5:00     ` [LTP] [PATCH v2 6/7] syscalls/swapon03: Simply this case Yang Xu
2023-12-22  5:00     ` [LTP] [PATCH v2 7/7] Add fallback for RHEL9 Yang Xu
2024-02-05 18:37       ` Petr Vorel
2024-01-02  2:07     ` [LTP] [PATCH v2 1/7] libltpswap: Add get_maxswapfiles api Yang Xu (Fujitsu)
2024-01-03 15:35     ` Cyril Hrubis
2024-02-05 18:43     ` Petr Vorel
2024-02-06  8:55       ` Yang Xu (Fujitsu) via ltp
2023-12-15  6:04 ` [LTP] [PATCH 1/3] " Yang Xu (Fujitsu)
2024-01-03 14:53 ` Cyril Hrubis

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=ZZV-i5pZ-SNdFT5b@yuki \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=xuyang2018.jy@fujitsu.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.