The patch titled Subject: mm/hotplug: optimize clear_hwpoisoned_pages() has been added to the -mm tree. Its filename is mm-hotplug-optimize-clear_hwpoisoned_pages.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-hotplug-optimize-clear_hwpoisoned_pages.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-hotplug-optimize-clear_hwpoisoned_pages.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: Balbir Singh <bsingharora@xxxxxxxxx> Subject: mm/hotplug: optimize clear_hwpoisoned_pages() In hot remove, we try to clear poisoned pages, but a small optimization to check if num_poisoned_pages is 0 helps remove the iteration through nr_pages. Link: http://lkml.kernel.org/r/20181102120001.4526-1-bsingharora@xxxxxxxxx Signed-off-by: Balbir Singh <bsingharora@xxxxxxxxx> Acked-by: Michal Hocko <mhocko@xxxxxxxx> Cc: Naoya Horiguchi <nao.horiguchi@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/sparse.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/mm/sparse.c~mm-hotplug-optimize-clear_hwpoisoned_pages +++ a/mm/sparse.c @@ -724,6 +724,16 @@ static void clear_hwpoisoned_pages(struc if (!memmap) return; + /* + * A further optimization is to have per section + * ref counted num_poisoned_pages, but that is going + * to need more space per memmap, for now just do + * a quick global check, this should speed up this + * routine in the absence of bad pages. + */ + if (atomic_long_read(&num_poisoned_pages) == 0) + return; + for (i = 0; i < nr_pages; i++) { if (PageHWPoison(&memmap[i])) { atomic_long_sub(1, &num_poisoned_pages); _ Patches currently in -mm which might be from bsingharora@xxxxxxxxx are mm-hotplug-optimize-clear_hwpoisoned_pages.patch