From: Baoquan He <bhe@redhat.com>
To: qiwuchen55@gmail.com, Michal Hocko <mhocko@kernel.org>
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 15:34:47 +0800 [thread overview]
Message-ID: <20200320073447.GA3039@MiWiFi-R3L-srv> (raw)
In-Reply-To: <20200319160707.GG20800@dhcp22.suse.cz>
On 03/19/20 at 05:07pm, Michal Hocko wrote:
> On Thu 19-03-20 23:50:26, qiwuchen55@gmail.com wrote:
> > 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.
>
> Why is this an improvement? While we can hide the scan_control
> dereference I am not seeing why this would be so much better.
> Quite worse TBH because cgroup_reclaim is a predicate while you make it
> return an object. This might be highly subjective thing, though.
>
> Does the patch result in a better code generation at least. Because
> without any obvious improvement I am not sure this is worth inclusion.
I tend to agree with Michal. The returned bool looks good.
If you really care about the internal conversion, maybe a slight change
as below?
static struct mem_cgroup *cgroup_reclaim(struct scan_control *sc)
{
return !!sc->target_mem_cgroup;
}
next prev parent reply other threads:[~2020-03-20 7:34 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 [this message]
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
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=20200320073447.GA3039@MiWiFi-R3L-srv \
--to=bhe@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=chenqiwu@xiaomi.com \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=qiwuchen55@gmail.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;
as well as URLs for NNTP newsgroup(s).