diff mbox series

[2/4] mm/page_alloc: correct return value when failing at preparing

Message ID 20210713135625.7615-3-mgorman@techsingularity.net (mailing list archive)
State New
Headers show
Series 5.14-rc1 mm/page_alloc.c stray patches | expand

Commit Message

Mel Gorman July 13, 2021, 1:56 p.m. UTC
From: Yanfei Xu <yanfei.xu@windriver.com>

If the array passed in is already partially populated, we should
return "nr_populated" even failing at preparing arguments stage.

Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
Link: https://lore.kernel.org/r/20210709102855.55058-1-yanfei.xu@windriver.com
---
 mm/page_alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Chuck Lever July 13, 2021, 2:21 p.m. UTC | #1
> On Jul 13, 2021, at 9:56 AM, Mel Gorman <mgorman@techsingularity.net> wrote:
> 
> From: Yanfei Xu <yanfei.xu@windriver.com>
> 
> If the array passed in is already partially populated, we should
> return "nr_populated" even failing at preparing arguments stage.
> 
> Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
> Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
> Link: https://lore.kernel.org/r/20210709102855.55058-1-yanfei.xu@windriver.com
> ---
> mm/page_alloc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 6ef86f338151..803414ce9264 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -5255,7 +5255,7 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid,
> 	gfp &= gfp_allowed_mask;
> 	alloc_gfp = gfp;
> 	if (!prepare_alloc_pages(gfp, 0, preferred_nid, nodemask, &ac, &alloc_gfp, &alloc_flags))
> -		return 0;
> +		return nr_populated;

Can you restore the hunk in patch 3/4 that changes this "return nr_populated;"
to "goto out;" ?


> 	gfp = alloc_gfp;
> 
> 	/* Find an allowed local zone that meets the low watermark. */
> -- 
> 2.26.2
> 

--
Chuck Lever
Mel Gorman July 13, 2021, 2:56 p.m. UTC | #2
On Tue, Jul 13, 2021 at 02:21:58PM +0000, Chuck Lever III wrote:
> 
> 
> > On Jul 13, 2021, at 9:56 AM, Mel Gorman <mgorman@techsingularity.net> wrote:
> > 
> > From: Yanfei Xu <yanfei.xu@windriver.com>
> > 
> > If the array passed in is already partially populated, we should
> > return "nr_populated" even failing at preparing arguments stage.
> > 
> > Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
> > Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
> > Link: https://lore.kernel.org/r/20210709102855.55058-1-yanfei.xu@windriver.com
> > ---
> > mm/page_alloc.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index 6ef86f338151..803414ce9264 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -5255,7 +5255,7 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid,
> > 	gfp &= gfp_allowed_mask;
> > 	alloc_gfp = gfp;
> > 	if (!prepare_alloc_pages(gfp, 0, preferred_nid, nodemask, &ac, &alloc_gfp, &alloc_flags))
> > -		return 0;
> > +		return nr_populated;
> 
> Can you restore the hunk in patch 3/4 that changes this "return nr_populated;"
> to "goto out;" ?
> 

I fixed that up in the series I sent out. I applied this patch first
then reconciled the collision with your patch.
Chuck Lever July 13, 2021, 3:01 p.m. UTC | #3
> On Jul 13, 2021, at 10:56 AM, Mel Gorman <mgorman@techsingularity.net> wrote:
> 
> On Tue, Jul 13, 2021 at 02:21:58PM +0000, Chuck Lever III wrote:
>> 
>> 
>>> On Jul 13, 2021, at 9:56 AM, Mel Gorman <mgorman@techsingularity.net> wrote:
>>> 
>>> From: Yanfei Xu <yanfei.xu@windriver.com>
>>> 
>>> If the array passed in is already partially populated, we should
>>> return "nr_populated" even failing at preparing arguments stage.
>>> 
>>> Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
>>> Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
>>> Link: https://lore.kernel.org/r/20210709102855.55058-1-yanfei.xu@windriver.com
>>> ---
>>> mm/page_alloc.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>> 
>>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>>> index 6ef86f338151..803414ce9264 100644
>>> --- a/mm/page_alloc.c
>>> +++ b/mm/page_alloc.c
>>> @@ -5255,7 +5255,7 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid,
>>> 	gfp &= gfp_allowed_mask;
>>> 	alloc_gfp = gfp;
>>> 	if (!prepare_alloc_pages(gfp, 0, preferred_nid, nodemask, &ac, &alloc_gfp, &alloc_flags))
>>> -		return 0;
>>> +		return nr_populated;
>> 
>> Can you restore the hunk in patch 3/4 that changes this "return nr_populated;"
>> to "goto out;" ?
>> 
> 
> I fixed that up in the series I sent out. I applied this patch first
> then reconciled the collision with your patch.

3/4 still needs to change this "return nr_populated;" to "goto out;"
as part of the clean up.


--
Chuck Lever
Mel Gorman July 13, 2021, 3:21 p.m. UTC | #4
On Tue, Jul 13, 2021 at 03:01:24PM +0000, Chuck Lever III wrote:
> 
> 
> > On Jul 13, 2021, at 10:56 AM, Mel Gorman <mgorman@techsingularity.net> wrote:
> > 
> > On Tue, Jul 13, 2021 at 02:21:58PM +0000, Chuck Lever III wrote:
> >> 
> >> 
> >>> On Jul 13, 2021, at 9:56 AM, Mel Gorman <mgorman@techsingularity.net> wrote:
> >>> 
> >>> From: Yanfei Xu <yanfei.xu@windriver.com>
> >>> 
> >>> If the array passed in is already partially populated, we should
> >>> return "nr_populated" even failing at preparing arguments stage.
> >>> 
> >>> Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
> >>> Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
> >>> Link: https://lore.kernel.org/r/20210709102855.55058-1-yanfei.xu@windriver.com
> >>> ---
> >>> mm/page_alloc.c | 2 +-
> >>> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>> 
> >>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> >>> index 6ef86f338151..803414ce9264 100644
> >>> --- a/mm/page_alloc.c
> >>> +++ b/mm/page_alloc.c
> >>> @@ -5255,7 +5255,7 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid,
> >>> 	gfp &= gfp_allowed_mask;
> >>> 	alloc_gfp = gfp;
> >>> 	if (!prepare_alloc_pages(gfp, 0, preferred_nid, nodemask, &ac, &alloc_gfp, &alloc_flags))
> >>> -		return 0;
> >>> +		return nr_populated;
> >> 
> >> Can you restore the hunk in patch 3/4 that changes this "return nr_populated;"
> >> to "goto out;" ?
> >> 
> > 
> > I fixed that up in the series I sent out. I applied this patch first
> > then reconciled the collision with your patch.
> 
> 3/4 still needs to change this "return nr_populated;" to "goto out;"
> as part of the clean up.
> 

Sorry, I had that in my git tree but didn't refresh the broken-out
series properly before sending. I've sent a v2.
diff mbox series

Patch

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 6ef86f338151..803414ce9264 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5255,7 +5255,7 @@  unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid,
 	gfp &= gfp_allowed_mask;
 	alloc_gfp = gfp;
 	if (!prepare_alloc_pages(gfp, 0, preferred_nid, nodemask, &ac, &alloc_gfp, &alloc_flags))
-		return 0;
+		return nr_populated;
 	gfp = alloc_gfp;
 
 	/* Find an allowed local zone that meets the low watermark. */