The patch titled powerpc-make-the-cmm-memory-hotplug-aware-update has been added to the -mm tree. Its filename is powerpc-make-the-cmm-memory-hotplug-aware-update.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/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: powerpc-make-the-cmm-memory-hotplug-aware-update From: Robert Jennings <rcj@xxxxxxxxxxxxxxxxxx> The pages used to track loaned pages should not be marked as MOVABLE, so they need to be handled during a memory offline event. Changes: * The structures for recording loaned pages are not allocated as MOVABLE * The structures for recording loaned pages are removed from sections being taken offline by moving their contents to a newly allocated page. Signed-off-by: Robert Jennings <rcj@xxxxxxxxxxxxxxxxxx> Cc: Mel Gorman <mel@xxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxx> Cc: Brian King <brking@xxxxxxxxxxxxxxxxxx> Cc: Paul Mackerras <paulus@xxxxxxxxx> Cc: Martin Schwidefsky <schwidefsky@xxxxxxxxxx> Cc: Gerald Schaefer <geralds@xxxxxxxxxxxxxxxxxx> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- arch/powerpc/platforms/pseries/cmm.c | 39 +++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) diff -puN arch/powerpc/platforms/pseries/cmm.c~powerpc-make-the-cmm-memory-hotplug-aware-update arch/powerpc/platforms/pseries/cmm.c --- a/arch/powerpc/platforms/pseries/cmm.c~powerpc-make-the-cmm-memory-hotplug-aware-update +++ a/arch/powerpc/platforms/pseries/cmm.c @@ -148,8 +148,7 @@ static long cmm_alloc_pages(long nr) spin_unlock(&cmm_lock); npa = (struct cmm_page_array *)__get_free_page( GFP_NOIO | __GFP_NOWARN | - __GFP_NORETRY | __GFP_NOMEMALLOC | - __GFP_MOVABLE); + __GFP_NORETRY | __GFP_NOMEMALLOC); if (!npa) { pr_info("%s: Can not allocate new page list\n", __func__); free_page(addr); @@ -480,6 +479,8 @@ static unsigned long cmm_count_pages(voi spin_lock(&cmm_lock); pa = cmm_page_list; while (pa) { + if ((unsigned long)pa >= start && (unsigned long)pa < end) + marg->pages_found++; for (idx = 0; idx < pa->index; idx++) if (pa->page[idx] >= start && pa->page[idx] < end) marg->pages_found++; @@ -531,7 +532,7 @@ static int cmm_mem_going_offline(void *a struct memory_notify *marg = arg; unsigned long start_page = (unsigned long)pfn_to_kaddr(marg->start_pfn); unsigned long end_page = start_page + (marg->nr_pages << PAGE_SHIFT); - struct cmm_page_array *pa_curr, *pa_last; + struct cmm_page_array *pa_curr, *pa_last, *npa; unsigned long idx; unsigned long freed = 0; @@ -539,6 +540,7 @@ static int cmm_mem_going_offline(void *a start_page, marg->nr_pages); spin_lock(&cmm_lock); + /* Search the page list for pages in the range to be offlined */ pa_last = pa_curr = cmm_page_list; while (pa_curr) { for (idx = (pa_curr->index - 1); (idx + 1) > 0; idx--) { @@ -563,6 +565,37 @@ static int cmm_mem_going_offline(void *a } pa_curr = pa_curr->next; } + + /* Search for page list structures in the range to be offlined */ + pa_last = NULL; + pa_curr = cmm_page_list; + while (pa_curr) { + if (((unsigned long)pa_curr >= start_page) && + ((unsigned long)pa_curr < end_page)) { + npa = (struct cmm_page_array *)__get_free_page( + GFP_NOIO | __GFP_NOWARN | + __GFP_NORETRY | __GFP_NOMEMALLOC); + if (!npa) { + spin_unlock(&cmm_lock); + cmm_dbg("Failed to allocate memory for list " + "management. Memory hotplug " + "failed.\n"); + return ENOMEM; + } + memcpy(npa, pa_curr, PAGE_SIZE); + if (pa_curr == cmm_page_list) + cmm_page_list = npa; + if (pa_last) + pa_last->next = npa; + free_page((unsigned long) pa_curr); + freed++; + pa_curr = npa; + } + + pa_last = pa_curr; + pa_curr = pa_curr->next; + } + spin_unlock(&cmm_lock); cmm_dbg("Released %ld pages in the search range.\n", freed); _ Patches currently in -mm which might be from rcj@xxxxxxxxxxxxxxxxxx are mm-add-notifier-in-pageblock-isolation-for-balloon-drivers.patch powerpc-make-the-cmm-memory-hotplug-aware.patch powerpc-make-the-cmm-memory-hotplug-aware-update.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html