Skip to content

Commit 2cafb58

Browse files
Hugh Dickinsakpm00
authored andcommitted
mempolicy: remove confusing MPOL_MF_LAZY dead code
v3.8 commit b24f53a ("mm: mempolicy: Add MPOL_MF_LAZY") introduced MPOL_MF_LAZY, and included it in the MPOL_MF_VALID flags; but a720094 ("mm: mempolicy: Hide MPOL_NOOP and MPOL_MF_LAZY from userspace for now") immediately removed it from MPOL_MF_VALID flags, pending further review. "This will need to be revisited", but it has not been reinstated. The present state is confusing: there is dead code in mm/mempolicy.c to handle MPOL_MF_LAZY cases which can never occur. Remove that: it can be resurrected later if necessary. But keep the definition of MPOL_MF_LAZY, which must remain in the UAPI, even though it always fails with EINVAL. https://lore.kernel.org/linux-mm/[email protected]/ links to a previous request to remove MPOL_MF_LAZY. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Hugh Dickins <[email protected]> Reviewed-by: Matthew Wilcox (Oracle) <[email protected]> Reviewed-by: Yang Shi <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Christoph Lameter <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: "Huang, Ying" <[email protected]> Cc: Kefeng Wang <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Mike Kravetz <[email protected]> Cc: Nhat Pham <[email protected]> Cc: Sidhartha Kumar <[email protected]> Cc: Suren Baghdasaryan <[email protected]> Cc: Tejun heo <[email protected]> Cc: Vishal Moola (Oracle) <[email protected]> Cc: Yosry Ahmed <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 35ec8fa commit 2cafb58

File tree

2 files changed

+1
-19
lines changed

2 files changed

+1
-19
lines changed

include/uapi/linux/mempolicy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ enum {
4848
#define MPOL_MF_MOVE (1<<1) /* Move pages owned by this process to conform
4949
to policy */
5050
#define MPOL_MF_MOVE_ALL (1<<2) /* Move every page to conform to policy */
51-
#define MPOL_MF_LAZY (1<<3) /* Modifies '_MOVE: lazy migrate on fault */
51+
#define MPOL_MF_LAZY (1<<3) /* UNSUPPORTED FLAG: Lazy migrate on fault */
5252
#define MPOL_MF_INTERNAL (1<<4) /* Internal flags start here */
5353

5454
#define MPOL_MF_VALID (MPOL_MF_STRICT | \

mm/mempolicy.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -636,12 +636,6 @@ unsigned long change_prot_numa(struct vm_area_struct *vma,
636636

637637
return nr_updated;
638638
}
639-
#else
640-
static unsigned long change_prot_numa(struct vm_area_struct *vma,
641-
unsigned long addr, unsigned long end)
642-
{
643-
return 0;
644-
}
645639
#endif /* CONFIG_NUMA_BALANCING */
646640

647641
static int queue_pages_test_walk(unsigned long start, unsigned long end,
@@ -680,14 +674,6 @@ static int queue_pages_test_walk(unsigned long start, unsigned long end,
680674
if (endvma > end)
681675
endvma = end;
682676

683-
if (flags & MPOL_MF_LAZY) {
684-
/* Similar to task_numa_work, skip inaccessible VMAs */
685-
if (!is_vm_hugetlb_page(vma) && vma_is_accessible(vma) &&
686-
!(vma->vm_flags & VM_MIXEDMAP))
687-
change_prot_numa(vma, start, endvma);
688-
return 1;
689-
}
690-
691677
/*
692678
* Check page nodes, and queue pages to move, in the current vma.
693679
* But if no moving, and no strict checking, the scan can be skipped.
@@ -1254,9 +1240,6 @@ static long do_mbind(unsigned long start, unsigned long len,
12541240
if (IS_ERR(new))
12551241
return PTR_ERR(new);
12561242

1257-
if (flags & MPOL_MF_LAZY)
1258-
new->flags |= MPOL_F_MOF;
1259-
12601243
/*
12611244
* If we are using the default policy then operation
12621245
* on discontinuous address spaces is okay after all
@@ -1301,7 +1284,6 @@ static long do_mbind(unsigned long start, unsigned long len,
13011284

13021285
if (!err) {
13031286
if (!list_empty(&pagelist)) {
1304-
WARN_ON_ONCE(flags & MPOL_MF_LAZY);
13051287
nr_failed |= migrate_pages(&pagelist, new_folio, NULL,
13061288
start, MIGRATE_SYNC, MR_MEMPOLICY_MBIND, NULL);
13071289
}

0 commit comments

Comments
 (0)