linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: chenqiwu <qiwuchen55@gmail.com>
To: Chris Down <chris@chrisdown.name>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
	chenqiwu <chenqiwu@xiaomi.com>
Subject: Re: [PATCH] mm/vmscan: fix incorrect return type for cgroup_reclaim()
Date: Fri, 20 Mar 2020 10:20:46 +0800	[thread overview]
Message-ID: <20200320022046.GA31830@cqw-OptiPlex-7050> (raw)
In-Reply-To: <20200319162025.GA237751@chrisdown.name>

On Thu, Mar 19, 2020 at 04:20:25PM +0000, Chris Down wrote:
> qiwuchen55@gmail.com writes:
> >From: chenqiwu <chenqiwu@xiaomi.com>
> >
> >The return type of cgroup_reclaim() is bool, but the correct type
> >should be struct mem_cgroup pointer. As a result, cgroup_reclaim()
> >can be used to wrap sc->target_mem_cgroup in vmscan code.
> 
> The code changes looks okay to me, but the changelog and patch
> subject could do with some improvement. For example, the type isn't
> "incorrect" before and "correct" now, per se, it's just coercing
> from *struct mem_cgroup to bool.
> 
> Could you make it more clear what your intent is in the patch? If
> it's that you found the code confusing, you can just write something
> like:
> 
>     mm/vmscan: return target_mem_cgroup from cgroup_reclaim
> 
>     Previously the code splits apart the action of checking whether
> we are in     cgroup reclaim from getting the target memory cgroup
> for that reclaim. This     split is confusing and seems unnecessary,
> since cgroup_reclaim itself only     checks if sc->target_mem_cgroup
> is NULL or not, so merge the two use cases     into one by returning
> the target_mem_cgroup itself from cgroup_reclaim.
> 
> >Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
> 
> After improving the patch title and summary, you can add:
> 
> Acked-by: Chris Down <chris@chrisdown.name>
>
Hi Chris,
Thanks for your review. I will resend this as patch v2.

BTW, sc->target_mem_cgroup is just used when CONFIG_MEMCG=y,
so wrap it with config CONFIG_MEMCG will save some space for
those who build their kernels with cgroups disabled.

Qiwu


      parent reply	other threads:[~2020-03-20  2:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-19 15:50 [PATCH] mm/vmscan: fix incorrect return type for cgroup_reclaim() qiwuchen55
2020-03-19 16:07 ` Michal Hocko
2020-03-20  7:34   ` Baoquan He
2020-03-19 16:20 ` Chris Down
2020-03-19 17:36   ` Matthew Wilcox
2020-03-20  2:29     ` chenqiwu
2020-03-20  7:28     ` Michal Hocko
2020-03-20  2:20   ` chenqiwu [this message]

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=20200320022046.GA31830@cqw-OptiPlex-7050 \
    --to=qiwuchen55@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=chenqiwu@xiaomi.com \
    --cc=chris@chrisdown.name \
    --cc=linux-mm@kvack.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;
as well as URLs for NNTP newsgroup(s).