The patch titled Subject: hugetlb-add-demote-hugetlb-page-sysfs-interfaces-fix has been added to the -mm tree. Its filename is hugetlb-add-demote-hugetlb-page-sysfs-interfaces-fix.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/hugetlb-add-demote-hugetlb-page-sysfs-interfaces-fix.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/hugetlb-add-demote-hugetlb-page-sysfs-interfaces-fix.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Mike Kravetz <mike.kravetz@xxxxxxxxxx> Subject: hugetlb-add-demote-hugetlb-page-sysfs-interfaces-fix The n_mask initialization does not need to be protected by the mutex. Thanks for pointing that out. Simply move taking the mutex after this initialization code. Link: https://lkml.kernel.org/r/0530e4ef-2492-5186-f919-5db68edea654@xxxxxxxxxx Signed-off-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx> Cc: Oscar Salvador <osalvador@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/hugetlb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/mm/hugetlb.c~hugetlb-add-demote-hugetlb-page-sysfs-interfaces-fix +++ a/mm/hugetlb.c @@ -3486,9 +3486,6 @@ static ssize_t demote_store(struct kobje return err; h = kobj_to_hstate(kobj, &nid); - /* Synchronize with other sysfs operations modifying huge pages */ - mutex_lock(&h->resize_lock); - if (nid != NUMA_NO_NODE) { init_nodemask_of_node(&nodes_allowed, nid); n_mask = &nodes_allowed; @@ -3496,7 +3493,10 @@ static ssize_t demote_store(struct kobje n_mask = &node_states[N_MEMORY]; } + /* Synchronize with other sysfs operations modifying huge pages */ + mutex_lock(&h->resize_lock); spin_lock_irq(&hugetlb_lock); + while (nr_demote) { /* * Check for available pages to demote each time thorough the _ Patches currently in -mm which might be from mike.kravetz@xxxxxxxxxx are hugetlb-add-demote-hugetlb-page-sysfs-interfaces.patch hugetlb-add-demote-hugetlb-page-sysfs-interfaces-fix.patch mm-cma-add-cma_pages_valid-to-determine-if-pages-are-in-cma.patch hugetlb-be-sure-to-free-demoted-cma-pages-to-cma.patch hugetlb-add-demote-bool-to-gigantic-page-routines.patch hugetlb-add-hugetlb-demote-page-support.patch hugetlb-add-hugetlb-demote-page-support-v4.patch