From: Hui Su <sh_def@163.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: akpm@linux-foundation.org, gustavo@embeddedor.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] mm/list_lru: optimize condition of exiting the loop
Date: Wed, 28 Oct 2020 03:06:49 +0800 [thread overview]
Message-ID: <20201027190649.GA67829@rlk> (raw)
In-Reply-To: <ae359cb8-5bf9-c2e5-ddd0-812df81de0fb@suse.cz>
On Tue, Oct 27, 2020 at 07:45:53PM +0100, Vlastimil Babka wrote:
> On 10/27/20 6:04 PM, Hui Su wrote:
> > In list_lru_walk(), nr_to_walk type is 'unsigned long',
> > so nr_to_walk won't be '< 0'.
> >
> > In list_lru_walk_node(), nr_to_walk type is 'unsigned long',
> > so *nr_to_walk won't be '< 0' too.
> >
> > We can use '!nr_to_walk' instead of 'nr_to_walk <= 0', which
> > is more precise.
> >
> > Signed-off-by: Hui Su <sh_def@163.com>
>
> OK. Why not this too?
>
> --- a/mm/list_lru.c
> +++ b/mm/list_lru.c
> @@ -294,7 +294,7 @@ unsigned long list_lru_walk_node(struct list_lru *lru, int nid,
>
> isolated += list_lru_walk_one(lru, nid, NULL, isolate, cb_arg,
> nr_to_walk);
> - if (*nr_to_walk > 0 && list_lru_memcg_aware(lru)) {
> + if (*nr_to_walk && list_lru_memcg_aware(lru)) {
> for_each_memcg_cache_index(memcg_idx) {
> struct list_lru_node *nlru = &lru->node[nid];
>
>
Thanks for your fast reply.
I did not notice that, and i would add this to my change.
I will resend PATCH V2, and cc to you.
Thanks.
prev parent reply other threads:[~2020-10-27 19:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-27 17:04 Hui Su
2020-10-27 18:45 ` Vlastimil Babka
2020-10-27 19:06 ` Hui Su [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=20201027190649.GA67829@rlk \
--to=sh_def@163.com \
--cc=akpm@linux-foundation.org \
--cc=gustavo@embeddedor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=vbabka@suse.cz \
/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