linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/4] mm/gup: Minor fix, cleanup and improvements
@ 2025-04-10  3:57 Baoquan He
  2025-04-10  3:57 ` [PATCH v4 1/4] mm/gup: fix wrongly calculated returned value in fault_in_safe_writeable() Baoquan He
                   ` (3 more replies)
  0 siblings, 4 replies; 19+ messages in thread
From: Baoquan He @ 2025-04-10  3:57 UTC (permalink / raw)
  To: linux-mm; +Cc: akpm, david, osalvador, yanjun.zhu, linux-kernel, Baoquan He

These were made from code inspection in mm/gup.c.

v3->v4:
========
- Make patch 1 to fix the code bug in fault_in_safe_writeable();
- Add patch 4 to do the code optimization to make fault_in_xxx()
  functions own the consistent code style;
- Add reviewing tags from David and Oscar for patch 2;

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 (4):
  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: clean up codes in fault_in_xxx() functions

 mm/gup.c | 125 +++++++++++++++----------------------------------------
 1 file changed, 34 insertions(+), 91 deletions(-)

-- 
2.41.0



^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2025-04-14  3:44 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-10  3:57 [PATCH v4 0/4] mm/gup: Minor fix, cleanup and improvements Baoquan He
2025-04-10  3:57 ` [PATCH v4 1/4] mm/gup: fix wrongly calculated returned value in fault_in_safe_writeable() Baoquan He
2025-04-10  8:31   ` Oscar Salvador
2025-04-11  3:43   ` Andrew Morton
2025-04-11  5:32     ` Baoquan He
2025-04-11 15:07       ` Andreas Gruenbacher
2025-04-11 23:22         ` Andrew Morton
2025-04-11  8:44   ` David Hildenbrand
2025-04-10  3:57 ` [PATCH v4 2/4] mm/gup: remove unneeded checking in follow_page_pte() Baoquan He
2025-04-10  3:57 ` [PATCH v4 3/4] mm/gup: remove gup_fast_pgd_leaf() and clean up the relevant codes Baoquan He
2025-04-10  3:57 ` [PATCH v4 4/4] mm/gup: clean up codes in fault_in_xxx() functions Baoquan He
2025-04-11  8:54   ` David Hildenbrand
2025-04-11 11:15     ` Baoquan He
2025-04-11 11:41       ` David Hildenbrand
2025-04-13  1:07         ` Baoquan He
2025-04-13 20:02           ` David Hildenbrand
2025-04-13  2:04   ` [PATCH v5 " Baoquan He
2025-04-13 20:09     ` David Hildenbrand
2025-04-14  3:44       ` Baoquan He

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox