Linux Test Project
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Yang Xu <xuyang2018.jy@fujitsu.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v4 2/4] zram/zram_lib.sh: adapt the situation that zram device is being used
Date: Fri, 17 Dec 2021 08:48:08 +0100	[thread overview]
Message-ID: <YbxAuBpxXtPXIwYO@pevik> (raw)
In-Reply-To: <1639552849-2251-2-git-send-email-xuyang2018.jy@fujitsu.com>

Hi Xu,

> If zram-generator package is installed and works, then we can not remove zram module
> because zram swap is being used. This case needs a clean zram environment, change this
> test by using hot_add/hot_remove interface[1]. So even zram device is being used, we
> still can add zram device and remove them in cleanup.

BTW this was added in v4.2-rc1 (6 years ago, 6566d1a32bf7 ("zram: add dynamic
device add/remove functionality")). Hopefully anybody still supporting older
kernels is using old LTP for it.

> Also, zram01,02 case are adjuested to adapt the situation that CONFIG_ZRAM=y.
Very nice, thanks!

Reviewed-by: Petr Vorel <pvorel@suse.cz>

> 1]https://www.kernel.org/doc/html/latest/admin-guide/blockdev/zram.html#add-remove-zram-devices
nit: [1] https://www.kernel.org/doc/html/latest/admin-guide/blockdev/zram.html#add-remove-zram-devices

...
> -	modprobe zram num_devices=$dev_num || \
> -		tst_brk TBROK "failed to insert zram module"
> +	if [ ! -d "/sys/class/zram-control" ]; then
> +		modprobe zram num_devices=$dev_num
> +		module_load=1
> +		dev_start=0
> +		dev_end=$(($dev_num - 1))
> +		tst_res TPASS "all zram devices(/dev/zram0~$dev_end) successfully created"
nit: please all zram devices (/dev/zram0~$dev_end) ... (add space after devices)
> +		return
> +	fi

> -	dev_num_created=$(ls /dev/zram* | wc -w)
> +	dev_start=$(ls /dev/zram* | wc -w)
> +	dev_end=$(($dev_start + $dev_num - 1))

> -	if [ "$dev_num_created" -ne "$dev_num" ]; then
> -		tst_brk TFAIL "unexpected num of devices: $dev_num_created"
> -	fi
> +	for i in $(seq  $dev_start $dev_end); do
> +		cat /sys/class/zram-control/hot_add > /dev/null
> +	done

> -	tst_res TPASS "all zram devices successfully created"
> +	tst_res TPASS "all zram devices(/dev/zram$dev_start~$dev_end) successfully created"
and here.

Kind regards,
Petr

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

  reply	other threads:[~2021-12-17  7:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-15  7:20 [LTP] [PATCH v4 1/4] swapping01: skip test if zram-swap is being used Yang Xu
2021-12-15  7:20 ` [LTP] [PATCH v4 2/4] zram/zram_lib.sh: adapt the situation that zram device " Yang Xu
2021-12-17  7:48   ` Petr Vorel [this message]
2021-12-17  9:34     ` xuyang2018.jy
2021-12-17 10:34       ` Petr Vorel
2021-12-20  2:58         ` xuyang2018.jy
2021-12-20  8:52           ` Petr Vorel
2021-12-17  7:49   ` Petr Vorel
2021-12-15  7:20 ` [LTP] [PATCH v4 3/4] zram/zram03: Convert into new api Yang Xu
2021-12-17  8:22   ` Petr Vorel
2021-12-17  9:42     ` xuyang2018.jy
2021-12-17  8:24   ` Petr Vorel
2021-12-15  7:20 ` [LTP] [PATCH v4 4/4] zram/zram01.sh: Use mem_used_total field instead of compr_data_size field Yang Xu
2021-12-17  8:47   ` Petr Vorel
2021-12-17  9:45     ` xuyang2018.jy
2021-12-17 10:36       ` Petr Vorel
2021-12-17  7:01 ` [LTP] [PATCH v4 1/4] swapping01: skip test if zram-swap is being used Petr Vorel
2021-12-17  7:04   ` xuyang2018.jy

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=YbxAuBpxXtPXIwYO@pevik \
    --to=pvorel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox