Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757104AbaAHNww (ORCPT ); Wed, 8 Jan 2014 08:52:52 -0500 Received: from cantor2.suse.de ([195.135.220.15]:53994 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932252AbaAHNtE (ORCPT ); Wed, 8 Jan 2014 08:49:04 -0500 Date: Wed, 8 Jan 2014 14:49:03 +0100 From: Michal Hocko To: Bob Liu Cc: Sasha Levin , Wanpeng Li , Naoya Horiguchi , Bob Liu , Linux-MM , LKML Subject: Re: could you clarify mm/mempolicy: fix !vma in new_vma_page() Message-ID: <20140108134903.GI27937@dhcp22.suse.cz> References: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 08-01-14 21:10:29, Bob Liu wrote: [...] > >> > 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 Thanks! > >> > --- > >> > 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) That was meant to say BUG_ON(!vma) of course ;) but I guess your reviewed-by still applies so I will post it to Andrew. > >> > + 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 -- Michal Hocko SUSE Labs -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/