From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa0-f46.google.com (mail-oa0-f46.google.com [209.85.219.46]) by kanga.kvack.org (Postfix) with ESMTP id 5EE1E6B0035 for ; Wed, 8 Jan 2014 08:10:31 -0500 (EST) Received: by mail-oa0-f46.google.com with SMTP id l6so1708024oag.5 for ; Wed, 08 Jan 2014 05:10:31 -0800 (PST) Received: from mail-vb0-x236.google.com (mail-vb0-x236.google.com [2607:f8b0:400c:c02::236]) by mx.google.com with ESMTPS id x8si35259605qch.54.2014.01.08.05.10.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Jan 2014 05:10:30 -0800 (PST) Received: by mail-vb0-f54.google.com with SMTP id g10so1111922vbg.41 for ; Wed, 08 Jan 2014 05:10:30 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20140108124240.GH27937@dhcp22.suse.cz> References: <20140106112422.GA27602@dhcp22.suse.cz> <20140106141827.GB27602@dhcp22.suse.cz> <20140107102212.GC8756@dhcp22.suse.cz> <20140107173034.GE8756@dhcp22.suse.cz> <20140108100859.GC27937@dhcp22.suse.cz> <20140108124240.GH27937@dhcp22.suse.cz> Date: Wed, 8 Jan 2014 21:10:29 +0800 Message-ID: Subject: Re: could you clarify mm/mempolicy: fix !vma in new_vma_page() From: Bob Liu Content-Type: text/plain; charset=UTF-8 Sender: owner-linux-mm@kvack.org List-ID: To: Michal Hocko Cc: Sasha Levin , Wanpeng Li , Naoya Horiguchi , Bob Liu , Linux-MM , LKML On Wed, Jan 8, 2014 at 8:42 PM, Michal Hocko wrote: > On Wed 08-01-14 20:09:30, Bob Liu wrote: >> On Wed, Jan 8, 2014 at 6:08 PM, Michal Hocko wrote: >> >> > >> > If I was debugging this I would simply add printk into page_address_in_vma >> > error paths. >> > >> > Anyway, I think that at least hugetlbfs part should be reverted because >> > it might paper over real bugs. Although the migration would fail for >> > such hugetlb page we should catch that a weird page was tried to be >> > migrated. What about the patch below? >> >> Looks good to me. But we need to confirm whether our assumption is right. > > Which assumption you have in mind? non-linear mapping or failing on > anon_vma or f_mapping checks? > The assumption that the original BUG_ON(!vma) was triggered by non-linear mapping. >> Sasha, could you please have a test with Michal's patch? > > I obviously doesn't have anything against testing but we should really > focus on the original issue. This patch simply restores hugetlb code Oh, I see your point. Yes, I agree that your patch should be merged and if the BUG_ON() is triggered(which is unlikely) again. We can open another thread and analysis the root cause. >> > --- >> > From 2d61421f26a3b63b4670d71b7adc67e2191b6157 Mon Sep 17 00:00:00 2001 >> > From: Michal Hocko >> > Date: Wed, 8 Jan 2014 10:57:41 +0100 >> > Subject: [PATCH] mm: new_vma_page cannot see NULL vma for hugetlb pages >> > >> > 11c731e81bb0 (mm/mempolicy: fix !vma in new_vma_page()) has removed >> > BUG_ON(!vma) from new_vma_page which is partially correct because >> > page_address_in_vma will return EFAULT for non-linear mappings and at >> > least shared shmem might be mapped this way. >> > >> > The patch also tried to prevent NULL ptr for hugetlb pages which is not >> > correct AFAICS because hugetlb pages cannot be mapped as VM_NONLINEAR >> > and other conditions in page_address_in_vma seem to be legit and catch >> > real bugs. >> > >> > This patch restores BUG_ON for PageHuge to catch potential issues when >> > the to-be-migrated page is not setup properly. >> > >> > Signed-off-by: Michal Hocko Reviewed-by: Bob Liu >> > --- >> > mm/mempolicy.c | 6 ++---- >> > 1 file changed, 2 insertions(+), 4 deletions(-) >> > >> > diff --git a/mm/mempolicy.c b/mm/mempolicy.c >> > index 9e8d2d86978a..f3f51464a23b 100644 >> > --- a/mm/mempolicy.c >> > +++ b/mm/mempolicy.c >> > @@ -1199,10 +1199,8 @@ static struct page *new_vma_page(struct page *page, unsigned long private, int * >> > } >> > >> > if (PageHuge(page)) { >> > - if (vma) >> > - return alloc_huge_page_noerr(vma, address, 1); >> > - else >> > - return NULL; >> > + BUG_ON(vma) >> > + return alloc_huge_page_noerr(vma, address, 1); >> > } >> > /* >> > * if !vma, alloc_page_vma() will use task or system default policy >> > -- >> > 1.8.5.2 >> > -- Regards, --Bob -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org