From: gaowei Pu <pugaowei@gmail.com>
To: Michal Hocko <mhocko@suse.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Vlastimil Babka <vbabka@suse.cz>,
linux-mm@kvack.org
Subject: Re: [PATCH v2] mm/mmap.c: use IS_ERR_VALUE to check return value of get_unmapped_area
Date: Wed, 16 Oct 2019 13:50:01 +0800 [thread overview]
Message-ID: <CAJdJevX-7C2Ck9=iUJwYaW3R-pw+B+RUp2O4zvOjNHqWaBDa4Q@mail.gmail.com> (raw)
In-Reply-To: <20191015123301.GC24932@dhcp22.suse.cz>
[-- Attachment #1: Type: text/plain, Size: 1467 bytes --]
On Tue, Oct 15, 2019 at 8:33 PM Michal Hocko <mhocko@suse.com> wrote:
> On Sat 12-10-19 18:25:12, Gaowei Pu wrote:
> > get_unmapped_area already cover the offset_in_page() check and returned
> > with error ptr. So replace offset_in_page() with IS_ERR_VALUE().
>
> I have to say that I found offset_in_page check quite unintuitive. It is
> a relict from the past I suspect. A newer code seems to use
> IS_ERR_VALUE. If we want to make the code consistent then I am for it.
> Could you check other users as well? git grep suggests checking
> kernel/events/uprobes.c, mm/mmap.c and mm/mremap.c.
>
I only noticed the offset_in_page check after returned from get_unmapped_area
is redundant.
So I just replace the places where get_unmapped_area returned. As you
mentioned, IS_ERR_VALUE maybe
the newer code to check the error ptr compared to offset_in_page which is
really unintuitive and therefore I will
replace them in mm/mmap.c and mm/mremap.c.
> I would simply use the following for the changelog
> "
> get_unmapped_area returns an address or -errno on failure. Historically
> we have checked for the failure by offset_in_page() which is correct but
> quite hard to read. Newer code started using IS_ERR_VALUE which is much
> easier to read. Convert remaining users of offset_in_page as well.
>
> This shouldn't introduce any functional changes.
> "
>
> OK, I will use your changelog and resend a patch. Thanks.
>
> > 2.23.0
> >
>
> --
> Michal Hocko
> SUSE Labs
>
[-- Attachment #2: Type: text/html, Size: 2419 bytes --]
prev parent reply other threads:[~2019-10-16 5:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-12 10:25 Gaowei Pu
2019-10-15 12:33 ` Michal Hocko
2019-10-16 5:50 ` gaowei Pu [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='CAJdJevX-7C2Ck9=iUJwYaW3R-pw+B+RUp2O4zvOjNHqWaBDa4Q@mail.gmail.com' \
--to=pugaowei@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--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