From: Baoquan He <bhe@redhat.com>
To: linux-mm@kvack.org
Cc: akpm@linux-foundation.org, osalvador@suse.de, david@redhat.com,
mingo@kernel.org, yanjun.zhu@linux.dev,
linux-kernel@vger.kernel.org, Baoquan He <bhe@redhat.com>
Subject: [PATCH v3 0/3] mm/gup: Minor fix, cleanup and improvements
Date: Mon, 7 Apr 2025 11:03:03 +0800 [thread overview]
Message-ID: <20250407030306.411977-1-bhe@redhat.com> (raw)
These are made when I explore codes in mm/gup.c.
v2->v3:
=========
- In patch 1, change to use local variable 'start' as a loop cursor
in fault_in_readable() and fault_in_writeable() so that they have the
consistent code style with fault_in_safe_writeable(). Doing this can
avoid ugly long line caused by kinds of type cast (const char __user *).
Thanks to David who suggested two ways including this one, I found this
is better when changing code.
- In patch2, changes to add VM_WARN_ON_ONCE() for both below chekcing
because all external users of __get_user_pages() have done the
checking in is_valid_gup_args() before calling __get_user_pages().
Just adding these VM_WARN_ON_ONCE() in case, e.g internal setting
wrong flags in kernel code. Thanks to David for suggesting this.
- (gup_flags & (FOLL_PIN | FOLL_GET)) == (FOLL_PIN | FOLL_GET))
- !!pages != !!(gup_flags & (FOLL_GET | FOLL_PIN))
- Drop
- the old patch 3 of v2 because it's from misunderstanding;
- the old patch 4, 5 of v2 because they have been merged into x86
tip tree by Ingo;
- the old patch 7 of v2 because it has been coverred in another
thread. Thanks to David for telling the thread link.
- In patch 3, add reviewing tags from Oscar and David.
v1->v2:
==========
- In patch 1, I carelessly copied the fault_in_readable() as
fault_in_writeable(). Thanks to Yanjun for pointing it out.
- In patch 2, I copied the code in follow_page_pte() to
__get_user_pages() directly w/o adjustment which is done but not
merged to patch. That failed testing taken by lkp test robot, thanks
for reporting.
Baoquan He (3):
mm/gup: fix wrongly calculated returned value in
fault_in_safe_writeable()
mm/gup: remove unneeded checking in follow_page_pte()
mm/gup: remove gup_fast_pgd_leaf() and clean up the relevant codes
mm/gup.c | 100 ++++++++++++++++---------------------------------------
1 file changed, 28 insertions(+), 72 deletions(-)
--
2.41.0
next reply other threads:[~2025-04-07 3:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-07 3:03 Baoquan He [this message]
2025-04-07 3:03 ` [PATCH v3 1/3] mm/gup: fix wrongly calculated returned value in fault_in_safe_writeable() Baoquan He
2025-04-08 9:40 ` Oscar Salvador
2025-04-08 15:01 ` Baoquan He
2025-04-08 9:52 ` David Hildenbrand
2025-04-08 10:00 ` David Hildenbrand
2025-04-08 14:59 ` Baoquan He
2025-04-07 3:03 ` [PATCH v3 2/3] mm/gup: remove unneeded checking in follow_page_pte() Baoquan He
2025-04-08 9:04 ` Oscar Salvador
2025-04-08 9:15 ` David Hildenbrand
2025-04-07 3:03 ` [PATCH v3 3/3] mm/gup: remove gup_fast_pgd_leaf() and clean up the relevant codes Baoquan He
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=20250407030306.411977-1-bhe@redhat.com \
--to=bhe@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@kernel.org \
--cc=osalvador@suse.de \
--cc=yanjun.zhu@linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.