linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Michal Hocko <mhocko@suse.com>,
	Charan Teja Kalla <quic_charante@quicinc.com>
Cc: akpm@linux-foundation.org, pasha.tatashin@soleen.com,
	sjpark@amazon.de, sieberf@amazon.com, shakeelb@google.com,
	dhowells@redhat.com, willy@infradead.org, vbabka@suse.cz,
	minchan@kernel.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org,
	"iamjoonsoo.kim@lge.com" <iamjoonsoo.kim@lge.com>,
	Pavan Kondeti <quic_pkondeti@quicinc.com>
Subject: Re: [PATCH] mm: fix use-after free of page_ext after race with memory-offline
Date: Tue, 19 Jul 2022 17:54:06 +0200	[thread overview]
Message-ID: <7a77f387-9400-3b41-d89f-2f1ef7bfbdc4@redhat.com> (raw)
In-Reply-To: <YtbRF9Z1tVxgw+g0@dhcp22.suse.cz>

On 19.07.22 17:43, Michal Hocko wrote:
> On Tue 19-07-22 20:42:42, Charan Teja Kalla wrote:
>> Thanks Michal!!
>>
>> On 7/18/2022 8:24 PM, Michal Hocko wrote:
> [...]
>>>>>> diff --git a/mm/page_ext.c b/mm/page_ext.c
>>>>>> index 3dc715d..5ccd3ee 100644
>>>>>> --- a/mm/page_ext.c
>>>>>> +++ b/mm/page_ext.c
>>>>>> @@ -299,8 +299,9 @@ static void __free_page_ext(unsigned long pfn)
>>>>>>  	if (!ms || !ms->page_ext)
>>>>>>  		return;
>>>>>>  	base = get_entry(ms->page_ext, pfn);
>>>>>> -	free_page_ext(base);
>>>>>>  	ms->page_ext = NULL;
>>>>>> +	synchronize_rcu();
>>>>>> +	free_page_ext(base);
>>>>>>  }
>>>>> So you are imposing the RCU grace period for each page_ext! This can get
>>>>> really expensive. Have you tried to measure the effect?
>>> I was wrong here! This is for each memory section which is not as
>>> terrible as every single page_ext. This can be still quite a lot memory
>>> sections in a single memory block (e.g. on ppc memory sections are
>>> ridiculously small).
>>>
>>
>> On the ARM64, I see that the minimum a section size will go is 128MB. I
>> think 16MB is the section size on ppc. Any inputs on how frequently
>> offline/online operation is being done on this ppc arch?
> 
> I have seen several reports where 16MB sections were used on PPC LPARs
> with a non trivial size. My usual answer to that is tha this is mostly a
> self inflicted injury but I am told that for some reasons I cannot
> udnerstand this is not easy to change. So reasonable or not this is not
> all that uncommon in PPC land.
> 
> We definitely shouldn't optimize for those setups but we shouldn't make
> them suffer even more as well. Besides that it seems that a single
> rcu_synchronize per offline operation should be doable.

IIRC, any reasonable PPC64 installation uses LMB >= 256 MiB, which maps
to the logical memory block size, and we only online/offline complete
memory blocks, not individual memory sections.

So one these installations, you'll see memory getting onlined/offlined
in at least 256MiB granularity.

-- 
Thanks,

David / dhildenb



  reply	other threads:[~2022-07-19 15:54 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14 14:47 Charan Teja Kalla
2022-07-15  1:04 ` Andrew Morton
2022-07-15 12:32   ` Charan Teja Kalla
2022-07-18  6:11 ` Pavan Kondeti
2022-07-18 13:15   ` Charan Teja Kalla
2022-07-18 11:50 ` Michal Hocko
2022-07-18 13:58   ` Charan Teja Kalla
2022-07-18 14:54     ` Michal Hocko
2022-07-19 15:12       ` Charan Teja Kalla
2022-07-19 15:43         ` Michal Hocko
2022-07-19 15:54           ` David Hildenbrand [this message]
2022-07-20 15:08           ` Charan Teja Kalla
2022-07-20 15:22             ` Michal Hocko
2022-07-20  8:21         ` Pavan Kondeti
2022-07-20  9:10           ` Michal Hocko
2022-07-20 10:43             ` Charan Teja Kalla
2022-07-20 11:13               ` Michal Hocko
2022-07-19 15:19       ` David Hildenbrand
2022-07-19 15:37         ` Michal Hocko
2022-07-19 15:50           ` David Hildenbrand

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=7a77f387-9400-3b41-d89f-2f1ef7bfbdc4@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=minchan@kernel.org \
    --cc=pasha.tatashin@soleen.com \
    --cc=quic_charante@quicinc.com \
    --cc=quic_pkondeti@quicinc.com \
    --cc=shakeelb@google.com \
    --cc=sieberf@amazon.com \
    --cc=sjpark@amazon.de \
    --cc=vbabka@suse.cz \
    --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