Linux cgroups development
 help / color / mirror / Atom feed
From: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
To: Domenico Cerasuolo
	<cerasuolodomenico-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: dan.carpenter-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	kernel-team-M8Ki61LpUEw@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kselftest-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] selftests: cgroup: fix test_zswap error path and meaningless check
Date: Tue, 12 Sep 2023 10:18:02 -0700	[thread overview]
Message-ID: <20230912101802.25b280ac306694ff02001706@linux-foundation.org> (raw)
In-Reply-To: <20230912083800.57435-1-cerasuolodomenico-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On Tue, 12 Sep 2023 10:38:00 +0200 Domenico Cerasuolo <cerasuolodomenico-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> Replace destruction paths with simple returns before the test cgroup is
> created, there is nothing to free or destroy at that point.
> 
> Remove pointless check, stored_pages is a size_t and cannot be < 0.
> 
> ...
>
> @@ -208,8 +208,6 @@ static int test_no_kmem_bypass(const char *root)
>  		free(trigger_allocation);
>  		if (get_zswap_stored_pages(&stored_pages))
>  			break;
> -		if (stored_pages < 0)
> -			break;
>  		/* If memory was pushed to zswap, verify it belongs to memcg */
>  		if (stored_pages > stored_pages_threshold) {
>  			int zswapped = cg_read_key_long(test_group, "memory.stat", "zswapped ");

stored_pages will be set to -1 on error.  It would be better to cast
stored_pages to ssize_t in the check, rather than simply ignoring
errors?

  parent reply	other threads:[~2023-09-12 17:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-12  8:38 [PATCH] selftests: cgroup: fix test_zswap error path and meaningless check Domenico Cerasuolo
     [not found] ` <20230912083800.57435-1-cerasuolodomenico-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2023-09-12 17:18   ` Andrew Morton [this message]
2023-09-13  7:17     ` Domenico Cerasuolo

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=20230912101802.25b280ac306694ff02001706@linux-foundation.org \
    --to=akpm-de/tnxtf+jlsfhdxvbkv3wd2fqjk+8+b@public.gmane.org \
    --cc=cerasuolodomenico-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dan.carpenter-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=kernel-team-M8Ki61LpUEw@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kselftest-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /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