Hi Andrew, if this patchset is ok for you to merge? On Wed, Sep 18, 2013 at 08:38:54AM +0800, Wanpeng Li wrote: >madvise_hwpoison won't check if the page is small page or huge page and traverse >in small page granularity against the range unconditional, which result in a printk >flood "MCE xxx: already hardware poisoned" if the page is huge page. This patch fix >it by increase compound_order(compound_head(page)) for huge page iterator. > >Testcase: > >#define _GNU_SOURCE >#include <stdlib.h> >#include <stdio.h> >#include <sys/mman.h> >#include <unistd.h> >#include <fcntl.h> >#include <sys/types.h> >#include <errno.h> > >#define PAGES_TO_TEST 3 >#define PAGE_SIZE 4096 * 512 > >int main(void) >{ > char *mem; > int i; > > mem = mmap(NULL, PAGES_TO_TEST * PAGE_SIZE, > PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, 0, 0); > > if (madvise(mem, PAGES_TO_TEST * PAGE_SIZE, MADV_HWPOISON) == -1) > return -1; > > munmap(mem, PAGES_TO_TEST * PAGE_SIZE); > > return 0; >} > >Reviewed-by: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx> >Acked-by: Andi Kleen <ak@xxxxxxxxxxxxxxx> >Signed-off-by: Wanpeng Li <liwanp@xxxxxxxxxxxxxxxxxx> >--- > mm/madvise.c | 5 +++-- > 1 files changed, 3 insertions(+), 2 deletions(-) > >diff --git a/mm/madvise.c b/mm/madvise.c >index 6975bc8..539eeb9 100644 >--- a/mm/madvise.c >+++ b/mm/madvise.c >@@ -343,10 +343,11 @@ static long madvise_remove(struct vm_area_struct *vma, > */ > static int madvise_hwpoison(int bhv, unsigned long start, unsigned long end) > { >+ struct page *p; > if (!capable(CAP_SYS_ADMIN)) > return -EPERM; >- for (; start < end; start += PAGE_SIZE) { >- struct page *p; >+ for (; start < end; start += PAGE_SIZE << >+ compound_order(compound_head(p))) { > int ret; > > ret = get_user_pages_fast(start, 1, 0, &p); >-- >1.7.5.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>