From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754284AbbCEGxb (ORCPT ); Thu, 5 Mar 2015 01:53:31 -0500 Received: from mail-ig0-f171.google.com ([209.85.213.171]:45107 "EHLO mail-ig0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753892AbbCEGxa (ORCPT ); Thu, 5 Mar 2015 01:53:30 -0500 Date: Wed, 4 Mar 2015 22:53:27 -0800 (PST) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Kazutomo Yoshii cc: Naoya Horiguchi , linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: fix do_mbind return value In-Reply-To: <54F7BD54.5060502@gmail.com> Message-ID: References: <54F7BD54.5060502@gmail.com> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 4 Mar 2015, Kazutomo Yoshii wrote: > I noticed that numa_alloc_onnode() failed to allocate memory on a > specified node in v4.0-rc1. I added a code to check the return value > of walk_page_range() in queue_pages_range() so that do_mbind() only > returns an error number or zero. > I assume this is libnuma-2.0.10? > Signed-off-by: Kazutomo Yoshii > --- > mm/mempolicy.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/mm/mempolicy.c b/mm/mempolicy.c > index 4721046..ea79171 100644 > --- a/mm/mempolicy.c > +++ b/mm/mempolicy.c > @@ -644,6 +644,7 @@ queue_pages_range(struct mm_struct *mm, unsigned long start, unsigned long end, > .nmask = nodes, > .prev = NULL, > }; > + int err; > struct mm_walk queue_pages_walk = { > .hugetlb_entry = queue_pages_hugetlb, > .pmd_entry = queue_pages_pte_range, > @@ -652,7 +653,10 @@ queue_pages_range(struct mm_struct *mm, unsigned long start, unsigned long end, > .private = &qp, > }; > - return walk_page_range(start, end, &queue_pages_walk); > + err = walk_page_range(start, end, &queue_pages_walk); > + if (err < 0) > + return err; > + return 0; > } > /* I'm afraid I don't think this is the right fix, if walk_page_range() returns a positive value then it should be supplied by one of the callbacks in the struct mm_walk, which none of these happen to do. I think this may be a problem with commit 6f4576e3687b ("mempolicy: apply page table walker on queue_pages_range()"), so let's add Naoya to the thread.