All of lore.kernel.org
 help / color / mirror / Atom feed
* [merged mm-stable] mm-gup-remove-unnecessary-check-in-memfd_pin_folios.patch removed from -mm tree
@ 2025-05-13  6:55 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2025-05-13  6:55 UTC (permalink / raw)
  To: mm-commits, vivek.kasireddy, david, vishal.moola, akpm


The quilt patch titled
     Subject: mm/gup: remove unnecessary check in memfd_pin_folios()
has been removed from the -mm tree.  Its filename was
     mm-gup-remove-unnecessary-check-in-memfd_pin_folios.patch

This patch was dropped because it was merged into the mm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: "Vishal Moola (Oracle)" <vishal.moola@gmail.com>
Subject: mm/gup: remove unnecessary check in memfd_pin_folios()
Date: Tue, 29 Apr 2025 18:00:58 -0700

Patch series "mm/gup: Cleanup memfd_pin_folios()".

A couple straightforward cleanups to memfd_pin_folios() found through code
inspection.  Saves 124 bytes of kernel text overall and makes the code
more readable.


This patch (of 2):

Commit 89c1905d9c14 ("mm/gup: introduce memfd_pin_folios() for pinning
memfd folios") checks if filemap_get_folios_contig() returned duplicate
folios to prevent multiple attempts at pinning the same folio.

Commit 8ab1b1602396 ("mm: fix filemap_get_folios_contig returning batches
of identical folios") ensures that filemap_get_folios_contig() returns a
batch of distinct folios.

We can remove the duplicate folio check to simplify the code and save 58
bytes of text.

Link: https://lkml.kernel.org/r/20250430010059.892632-1-vishal.moola@gmail.com
Link: https://lkml.kernel.org/r/20250430010059.892632-2-vishal.moola@gmail.com
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/gup.c |   15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

--- a/mm/gup.c~mm-gup-remove-unnecessary-check-in-memfd_pin_folios
+++ a/mm/gup.c
@@ -3590,7 +3590,7 @@ long memfd_pin_folios(struct file *memfd
 {
 	unsigned int flags, nr_folios, nr_found;
 	unsigned int i, pgshift = PAGE_SHIFT;
-	pgoff_t start_idx, end_idx, next_idx;
+	pgoff_t start_idx, end_idx;
 	struct folio *folio = NULL;
 	struct folio_batch fbatch;
 	struct hstate *h;
@@ -3640,19 +3640,7 @@ long memfd_pin_folios(struct file *memfd
 				folio = NULL;
 			}
 
-			next_idx = 0;
 			for (i = 0; i < nr_found; i++) {
-				/*
-				 * As there can be multiple entries for a
-				 * given folio in the batch returned by
-				 * filemap_get_folios_contig(), the below
-				 * check is to ensure that we pin and return a
-				 * unique set of folios between start and end.
-				 */
-				if (next_idx &&
-				    next_idx != folio_index(fbatch.folios[i]))
-					continue;
-
 				folio = page_folio(&fbatch.folios[i]->page);
 
 				if (try_grab_folio(folio, 1, FOLL_PIN)) {
@@ -3665,7 +3653,6 @@ long memfd_pin_folios(struct file *memfd
 					*offset = offset_in_folio(folio, start);
 
 				folios[nr_folios] = folio;
-				next_idx = folio_next_index(folio);
 				if (++nr_folios == max_folios)
 					break;
 			}
_

Patches currently in -mm which might be from vishal.moola@gmail.com are



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-05-13  6:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-13  6:55 [merged mm-stable] mm-gup-remove-unnecessary-check-in-memfd_pin_folios.patch removed from -mm tree Andrew Morton

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.