From: Vlastimil Babka <vbabka@suse.cz>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-mm@kvack.org, netdev@vger.kernel.org,
Dongli Zhang <dongli.zhang@oracle.com>,
Aruna Ramakrishna <aruna.ramakrishna@oracle.com>,
Bert Barbe <bert.barbe@oracle.com>,
Rama Nichanamatlu <rama.nichanamatlu@oracle.com>,
Venkat Venkatsubra <venkat.x.venkatsubra@oracle.com>,
Manjunath Patil <manjunath.b.patil@oracle.com>,
Joe Jin <joe.jin@oracle.com>, SRINIVAS <srinivas.eeda@oracle.com>,
stable@vger.kernel.org, Jann Horn <jannh@google.com>
Subject: Re: [PATCH] page_frag: Recover from memory pressure
Date: Thu, 5 Nov 2020 13:09:15 +0100 [thread overview]
Message-ID: <bd404987-6c26-ae7d-55cf-be74b432c3ec@suse.cz> (raw)
In-Reply-To: <20201105120554.GJ17076@casper.infradead.org>
On 11/5/20 1:05 PM, Matthew Wilcox wrote:
> On Thu, Nov 05, 2020 at 12:56:43PM +0100, Vlastimil Babka wrote:
>> > +++ b/mm/page_alloc.c
>> > @@ -5139,6 +5139,10 @@ void *page_frag_alloc(struct page_frag_cache *nc,
>> > if (!page_ref_sub_and_test(page, nc->pagecnt_bias))
>> > goto refill;
>> > + if (nc->pfmemalloc) {
>> > + free_the_page(page, compound_order(page));
>> > + goto refill;
>>
>> Theoretically the refill can fail and we return NULL while leaving nc->va
>> pointing to a freed page, so I think you should set nc->va to NULL.
>>
>> Geez, can't the same thing already happen after we sub the nc->pagecnt_bias
>> from page ref, and last users of the page fragments then return them and dec
>> the ref to zero and the page gets freed?
>
> I don't think you read __page_frag_cache_refill() closely enough ...
Or rather not at all, sorry :) somehow I just saw "ah here we call the page
allocator".
Acked-by: Vlastimil Babka <vbabka@suse.cz>
>
> if (unlikely(!page))
> page = alloc_pages_node(NUMA_NO_NODE, gfp, 0);
>
> nc->va = page ? page_address(page) : NULL;
>
>
next prev parent reply other threads:[~2020-11-05 12:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-05 4:21 Matthew Wilcox (Oracle)
2020-11-05 11:56 ` Vlastimil Babka
2020-11-05 12:05 ` Matthew Wilcox
2020-11-05 12:09 ` Vlastimil Babka [this message]
2020-11-05 13:21 ` Eric Dumazet
2020-11-05 14:02 ` Matthew Wilcox
2020-11-09 14:32 ` Matthew Wilcox
2020-11-09 14:37 ` Eric Dumazet
2020-11-15 6:47 ` Dongli Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bd404987-6c26-ae7d-55cf-be74b432c3ec@suse.cz \
--to=vbabka@suse.cz \
--cc=aruna.ramakrishna@oracle.com \
--cc=bert.barbe@oracle.com \
--cc=dongli.zhang@oracle.com \
--cc=jannh@google.com \
--cc=joe.jin@oracle.com \
--cc=linux-mm@kvack.org \
--cc=manjunath.b.patil@oracle.com \
--cc=netdev@vger.kernel.org \
--cc=rama.nichanamatlu@oracle.com \
--cc=srinivas.eeda@oracle.com \
--cc=stable@vger.kernel.org \
--cc=venkat.x.venkatsubra@oracle.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox