Re: [PATCH v2] page_alloc: Fix freeing non-compound pages

2020-10-18 Thread Nicholas Piggin
Excerpts from Andrew Morton's message of September 29, 2020 2:46 pm: > On Tue, 29 Sep 2020 02:17:19 +0100 Matthew Wilcox wrote: > >> On Mon, Sep 28, 2020 at 06:03:07PM -0700, Andrew Morton wrote: >> > On Sat, 26 Sep 2020 22:39:19 +0100 "Matthew Wilcox (Oracle)" >> > wrote: >> > >> > > Here is

Re: [PATCH v2] page_alloc: Fix freeing non-compound pages

2020-09-30 Thread Mike Rapoport
On Tue, Sep 29, 2020 at 03:06:22PM +0100, Matthew Wilcox wrote: > On Tue, Sep 29, 2020 at 10:26:22AM +0300, Mike Rapoport wrote: > > This sentence presumes existing description/prior knowledge about > > put_page(). > > > > Maybe > > > > This function can free multi-page allocations that were

Re: [PATCH v2] page_alloc: Fix freeing non-compound pages

2020-09-29 Thread Matthew Wilcox
On Mon, Sep 28, 2020 at 09:46:56PM -0700, Andrew Morton wrote: > On Tue, 29 Sep 2020 02:17:19 +0100 Matthew Wilcox wrote: > > > On Mon, Sep 28, 2020 at 06:03:07PM -0700, Andrew Morton wrote: > > > On Sat, 26 Sep 2020 22:39:19 +0100 "Matthew Wilcox (Oracle)" > > > wrote: > > > > > > > Here is

Re: [PATCH v2] page_alloc: Fix freeing non-compound pages

2020-09-29 Thread Matthew Wilcox
On Tue, Sep 29, 2020 at 10:26:22AM +0300, Mike Rapoport wrote: > This sentence presumes existing description/prior knowledge about > put_page(). > > Maybe > > This function can free multi-page allocations that were not allocated > with %__GFP_COMP, unlike put_page() that would free only the

Re: [PATCH v2] page_alloc: Fix freeing non-compound pages

2020-09-29 Thread Mike Rapoport
On Tue, Sep 29, 2020 at 04:40:26AM +0100, Matthew Wilcox wrote: > On Mon, Sep 28, 2020 at 06:03:07PM -0700, Andrew Morton wrote: > > Well that's weird and scary looking. `page' has non-zero refcount yet > > we go and free random followon pages. Methinks it merits an > > explanatory comment? > >

Re: [PATCH v2] page_alloc: Fix freeing non-compound pages

2020-09-28 Thread Andrew Morton
On Tue, 29 Sep 2020 02:17:19 +0100 Matthew Wilcox wrote: > On Mon, Sep 28, 2020 at 06:03:07PM -0700, Andrew Morton wrote: > > On Sat, 26 Sep 2020 22:39:19 +0100 "Matthew Wilcox (Oracle)" > > wrote: > > > > > Here is a very rare race which leaks memory: > > > > Not worth a cc:stable? > >

Re: [PATCH v2] page_alloc: Fix freeing non-compound pages

2020-09-28 Thread Matthew Wilcox
On Mon, Sep 28, 2020 at 06:03:07PM -0700, Andrew Morton wrote: > Well that's weird and scary looking. `page' has non-zero refcount yet > we go and free random followon pages. Methinks it merits an > explanatory comment? Here's some kernel-doc. Opinions? /** * __free_pages - Free pages

Re: [PATCH v2] page_alloc: Fix freeing non-compound pages

2020-09-28 Thread Matthew Wilcox
On Mon, Sep 28, 2020 at 06:03:07PM -0700, Andrew Morton wrote: > On Sat, 26 Sep 2020 22:39:19 +0100 "Matthew Wilcox (Oracle)" > wrote: > > > Here is a very rare race which leaks memory: > > Not worth a cc:stable? Yes, it probably should have been. I just assume the stablebot will pick up

Re: [PATCH v2] page_alloc: Fix freeing non-compound pages

2020-09-28 Thread Andrew Morton
On Sat, 26 Sep 2020 22:39:19 +0100 "Matthew Wilcox (Oracle)" wrote: > Here is a very rare race which leaks memory: Not worth a cc:stable? > Page P0 is allocated to the page cache. Page P1 is free. > > Thread AThread BThread C > find_get_entry(): > xas_load()

[PATCH v2] page_alloc: Fix freeing non-compound pages

2020-09-26 Thread Matthew Wilcox (Oracle)
Here is a very rare race which leaks memory: Page P0 is allocated to the page cache. Page P1 is free. Thread AThread BThread C find_get_entry(): xas_load() returns P0 Removes P0 from page cache