From: Wei Yang <richard.weiyang@gmail.com>
To: Wei Yang <richard.weiyang@gmail.com>
Cc: linux-mm@kvack.org, akpm@linux-foundation.org, mhocko@suse.com,
osalvador@suse.de
Subject: Re: [PATCH] mm, sparse: remove check with __highest_present_section_nr in for_each_present_section_nr()
Date: Tue, 11 Dec 2018 05:09:53 +0000 [thread overview]
Message-ID: <20181211050953.nj3kwmwzhprsam5z@master> (raw)
In-Reply-To: <20181211035128.43256-1-richard.weiyang@gmail.com>
On Tue, Dec 11, 2018 at 11:51:28AM +0800, Wei Yang wrote:
>A valid present section number is in [0, __highest_present_section_nr].
>And the return value of next_present_section_nr() meets this
>requirement. This means it is not necessary to check it with
^ , if it is not (-1)
Would like to add this to be more exact.
>__highest_present_section_nr again in for_each_present_section_nr().
>
>Since we pass an unsigned long *section_nr* to
>for_each_present_section_nr(), we need to cast it to int before
>comparing.
>
>Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>---
> mm/sparse.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
>diff --git a/mm/sparse.c b/mm/sparse.c
>index a4fdbcb21514..9eaa8f98a3d2 100644
>--- a/mm/sparse.c
>+++ b/mm/sparse.c
>@@ -197,8 +197,7 @@ static inline int next_present_section_nr(int section_nr)
> }
> #define for_each_present_section_nr(start, section_nr) \
> for (section_nr = next_present_section_nr(start-1); \
>- ((section_nr >= 0) && \
>- (section_nr <= __highest_present_section_nr)); \
>+ (int)section_nr >= 0; \
> section_nr = next_present_section_nr(section_nr))
>
> static inline unsigned long first_present_section_nr(void)
>--
>2.15.1
--
Wei Yang
Help you, Help me
next prev parent reply other threads:[~2018-12-11 5:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-11 3:51 Wei Yang
2018-12-11 5:09 ` Wei Yang [this message]
2018-12-11 9:44 ` Michal Hocko
2018-12-11 10:19 ` Wei Yang
2018-12-11 10:23 ` Michal Hocko
2018-12-11 14:41 ` Wei Yang
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=20181211050953.nj3kwmwzhprsam5z@master \
--to=richard.weiyang@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=osalvador@suse.de \
/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