All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 4.1.28 Fix bad backport of 8f182270dfec "mm/swap.c: flush lru pvecs on compound page arrival"
@ 2016-07-14 21:55 Steven Rostedt
  2016-07-15  6:55 ` Michal Hocko
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2016-07-14 21:55 UTC (permalink / raw)
  To: Sasha Levin; +Cc: stable, Andrew Morton, Michal Hocko

When I pulled in 4.1.28 into my stable 4.1-rt tree and ran the tests,
it crashed with a severe OOM killing everything. I then tested 4.1.28
without -rt and it had the same issue. I did a bisect between 4.1.27
and 4.1.28 and found that the bug started at:

commit 8f182270dfec "mm/swap.c: flush lru pvecs on compound page
arrival"

Looking at that patch and what's in mainline, I see that there's a
mismatch in one of the hunks:

Mainline:

@@ -391,9 +391,8 @@ static void __lru_cache_add(struct page *page)
        struct pagevec *pvec = &get_cpu_var(lru_add_pvec);

        get_page(page);
-       if (!pagevec_space(pvec))
+       if (!pagevec_add(pvec, page) || PageCompound(page))
                __pagevec_lru_add(pvec);
-       pagevec_add(pvec, page);
        put_cpu_var(lru_add_pvec);
 }


Stable 4.1.28:

@@ -631,9 +631,8 @@ static void __lru_cache_add(struct page *page)
        struct pagevec *pvec = &get_cpu_var(lru_add_pvec);

        page_cache_get(page);
-       if (!pagevec_space(pvec))
+       if (!pagevec_space(pvec) || PageCompound(page))
                __pagevec_lru_add(pvec);
-       pagevec_add(pvec, page);
        put_cpu_var(lru_add_pvec);
 }


Where mainline replace pagevec_space() with pagevec_add, and stable did
not.

Fixing this makes the OOM go away.

Note, 3.18 has the same bug.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
diff --git a/mm/swap.c b/mm/swap.c
index b523f0a4cbfb..ab3b9c2dd783 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -631,7 +631,7 @@ static void __lru_cache_add(struct page *page)
 	struct pagevec *pvec = &get_cpu_var(lru_add_pvec);
 
 	page_cache_get(page);
-	if (!pagevec_space(pvec) || PageCompound(page))
+	if (!pagevec_add(pvec, page) || PageCompound(page))
 		__pagevec_lru_add(pvec);
 	put_cpu_var(lru_add_pvec);
 }

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] 4.1.28 Fix bad backport of 8f182270dfec "mm/swap.c: flush lru pvecs on compound page arrival"
  2016-07-14 21:55 [PATCH] 4.1.28 Fix bad backport of 8f182270dfec "mm/swap.c: flush lru pvecs on compound page arrival" Steven Rostedt
@ 2016-07-15  6:55 ` Michal Hocko
  2016-07-15 11:51   ` Sasha Levin
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Hocko @ 2016-07-15  6:55 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Sasha Levin, stable, Andrew Morton

On Thu 14-07-16 17:55:21, Steven Rostedt wrote:
> When I pulled in 4.1.28 into my stable 4.1-rt tree and ran the tests,
> it crashed with a severe OOM killing everything. I then tested 4.1.28
> without -rt and it had the same issue. I did a bisect between 4.1.27
> and 4.1.28 and found that the bug started at:
> 
> commit 8f182270dfec "mm/swap.c: flush lru pvecs on compound page
> arrival"
> 
> Looking at that patch and what's in mainline, I see that there's a
> mismatch in one of the hunks:
> 
> Mainline:
> 
> @@ -391,9 +391,8 @@ static void __lru_cache_add(struct page *page)
>         struct pagevec *pvec = &get_cpu_var(lru_add_pvec);
> 
>         get_page(page);
> -       if (!pagevec_space(pvec))
> +       if (!pagevec_add(pvec, page) || PageCompound(page))
>                 __pagevec_lru_add(pvec);
> -       pagevec_add(pvec, page);
>         put_cpu_var(lru_add_pvec);
>  }
> 
> 
> Stable 4.1.28:
> 
> @@ -631,9 +631,8 @@ static void __lru_cache_add(struct page *page)
>         struct pagevec *pvec = &get_cpu_var(lru_add_pvec);
> 
>         page_cache_get(page);
> -       if (!pagevec_space(pvec))
> +       if (!pagevec_space(pvec) || PageCompound(page))
>                 __pagevec_lru_add(pvec);
> -       pagevec_add(pvec, page);
>         put_cpu_var(lru_add_pvec);
>  }

Heh, I've made the same mistake when backporting this to our older SLES
based kernel initially. I was lucky the system even didn't boot. Sorry
that I didn't find time to review the stable backport.

> Where mainline replace pagevec_space() with pagevec_add, and stable did
> not.
> 
> Fixing this makes the OOM go away.
> 
> Note, 3.18 has the same bug.
> 
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
> diff --git a/mm/swap.c b/mm/swap.c
> index b523f0a4cbfb..ab3b9c2dd783 100644
> --- a/mm/swap.c
> +++ b/mm/swap.c
> @@ -631,7 +631,7 @@ static void __lru_cache_add(struct page *page)
>  	struct pagevec *pvec = &get_cpu_var(lru_add_pvec);
>  
>  	page_cache_get(page);
> -	if (!pagevec_space(pvec) || PageCompound(page))
> +	if (!pagevec_add(pvec, page) || PageCompound(page))
>  		__pagevec_lru_add(pvec);
>  	put_cpu_var(lru_add_pvec);
>  }

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] 4.1.28 Fix bad backport of 8f182270dfec "mm/swap.c: flush lru pvecs on compound page arrival"
  2016-07-15  6:55 ` Michal Hocko
@ 2016-07-15 11:51   ` Sasha Levin
  0 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2016-07-15 11:51 UTC (permalink / raw)
  To: Michal Hocko, Steven Rostedt; +Cc: stable, Andrew Morton

On 07/15/2016 02:55 AM, Michal Hocko wrote:
> On Thu 14-07-16 17:55:21, Steven Rostedt wrote:
>> > When I pulled in 4.1.28 into my stable 4.1-rt tree and ran the tests,
>> > it crashed with a severe OOM killing everything. I then tested 4.1.28
>> > without -rt and it had the same issue. I did a bisect between 4.1.27
>> > and 4.1.28 and found that the bug started at:
>> > 
>> > commit 8f182270dfec "mm/swap.c: flush lru pvecs on compound page
>> > arrival"
>> > 
>> > Looking at that patch and what's in mainline, I see that there's a
>> > mismatch in one of the hunks:
>> > 
>> > Mainline:
>> > 
>> > @@ -391,9 +391,8 @@ static void __lru_cache_add(struct page *page)
>> >         struct pagevec *pvec = &get_cpu_var(lru_add_pvec);
>> > 
>> >         get_page(page);
>> > -       if (!pagevec_space(pvec))
>> > +       if (!pagevec_add(pvec, page) || PageCompound(page))
>> >                 __pagevec_lru_add(pvec);
>> > -       pagevec_add(pvec, page);
>> >         put_cpu_var(lru_add_pvec);
>> >  }
>> > 
>> > 
>> > Stable 4.1.28:
>> > 
>> > @@ -631,9 +631,8 @@ static void __lru_cache_add(struct page *page)
>> >         struct pagevec *pvec = &get_cpu_var(lru_add_pvec);
>> > 
>> >         page_cache_get(page);
>> > -       if (!pagevec_space(pvec))
>> > +       if (!pagevec_space(pvec) || PageCompound(page))
>> >                 __pagevec_lru_add(pvec);
>> > -       pagevec_add(pvec, page);
>> >         put_cpu_var(lru_add_pvec);
>> >  }
> Heh, I've made the same mistake when backporting this to our older SLES
> based kernel initially. I was lucky the system even didn't boot. Sorry
> that I didn't find time to review the stable backport.
> 

Thanks all! I've queued the fix.


Thanks,
Sasha

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-07-15 11:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-14 21:55 [PATCH] 4.1.28 Fix bad backport of 8f182270dfec "mm/swap.c: flush lru pvecs on compound page arrival" Steven Rostedt
2016-07-15  6:55 ` Michal Hocko
2016-07-15 11:51   ` Sasha Levin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.