mempolicy.c (1aca5ce036e3499336d1a2ace3070f908381c055) mempolicy.c (7329e3ebe3594b425955ab591ecea335e85842c2)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Simple NUMA memory policy for the Linux kernel.
4 *
5 * Copyright 2003,2004 Andi Kleen, SuSE Labs.
6 * (C) Copyright 2005 Christoph Lameter, Silicon Graphics, Inc.
7 *
8 * NUMA policy allows the user to give hints in which node(s) memory should

--- 773 unchanged lines hidden (view full) ---

782 mpol_put(new);
783 return err;
784}
785
786/* Step 2: apply policy to a range and do splits. */
787static int mbind_range(struct mm_struct *mm, unsigned long start,
788 unsigned long end, struct mempolicy *new_pol)
789{
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Simple NUMA memory policy for the Linux kernel.
4 *
5 * Copyright 2003,2004 Andi Kleen, SuSE Labs.
6 * (C) Copyright 2005 Christoph Lameter, Silicon Graphics, Inc.
7 *
8 * NUMA policy allows the user to give hints in which node(s) memory should

--- 773 unchanged lines hidden (view full) ---

782 mpol_put(new);
783 return err;
784}
785
786/* Step 2: apply policy to a range and do splits. */
787static int mbind_range(struct mm_struct *mm, unsigned long start,
788 unsigned long end, struct mempolicy *new_pol)
789{
790 MA_STATE(mas, &mm->mm_mt, start - 1, start - 1);
790 MA_STATE(mas, &mm->mm_mt, start, start);
791 struct vm_area_struct *prev;
792 struct vm_area_struct *vma;
793 int err = 0;
794 pgoff_t pgoff;
795
791 struct vm_area_struct *prev;
792 struct vm_area_struct *vma;
793 int err = 0;
794 pgoff_t pgoff;
795
796 prev = mas_find_rev(&mas, 0);
797 if (prev && (start < prev->vm_end))
798 vma = prev;
799 else
800 vma = mas_next(&mas, end - 1);
796 prev = mas_prev(&mas, 0);
797 if (unlikely(!prev))
798 mas_set(&mas, start);
801
799
800 vma = mas_find(&mas, end - 1);
801 if (WARN_ON(!vma))
802 return 0;
803
804 if (start > vma->vm_start)
805 prev = vma;
806
802 for (; vma; vma = mas_next(&mas, end - 1)) {
803 unsigned long vmstart = max(start, vma->vm_start);
804 unsigned long vmend = min(end, vma->vm_end);
805
806 if (mpol_equal(vma_policy(vma), new_pol))
807 goto next;
808
809 pgoff = vma->vm_pgoff +

--- 2352 unchanged lines hidden ---
807 for (; vma; vma = mas_next(&mas, end - 1)) {
808 unsigned long vmstart = max(start, vma->vm_start);
809 unsigned long vmend = min(end, vma->vm_end);
810
811 if (mpol_equal(vma_policy(vma), new_pol))
812 goto next;
813
814 pgoff = vma->vm_pgoff +

--- 2352 unchanged lines hidden ---