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

2020-09-24 Thread Matthew Wilcox
On Thu, Sep 24, 2020 at 11:00:02AM +0200, pet...@infradead.org wrote: > On Tue, Sep 22, 2020 at 03:00:17PM +0100, Matthew Wilcox (Oracle) wrote: > > Here is a very rare race which leaks memory: > > > > Page P0 is allocated to the page cache. > > Page P1 is free. > > > > Thread AThread

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

2020-09-24 Thread peterz
On Tue, Sep 22, 2020 at 03:00:17PM +0100, Matthew Wilcox (Oracle) wrote: > Here is a very rare race which leaks memory: > > Page P0 is allocated to the page cache. > Page P1 is free. > > Thread A Thread BThread C > find_get_entry(): > xas_load() returns P0 >

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

2020-09-22 Thread Matthew Wilcox
On Tue, Sep 22, 2020 at 03:00:17PM +0100, Matthew Wilcox (Oracle) wrote: > void __free_pages(struct page *page, unsigned int order) > { > if (put_page_testzero(page)) > free_the_page(page, order); > + else > + while (order-- > 0) > + free_th

[PATCH] page_alloc: Fix freeing non-compound pages

2020-09-22 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