[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240925134706.2a0c2717a41a338d938581ff@linux-foundation.org>
Date: Wed, 25 Sep 2024 13:47:06 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Adrian Huang <adrianhuang0701@...il.com>
Cc: Andrey Ryabinin <ryabinin.a.a@...il.com>, Alexander Potapenko
<glider@...gle.com>, Andrey Konovalov <andreyknvl@...il.com>, Dmitry Vyukov
<dvyukov@...gle.com>, Vincenzo Frascino <vincenzo.frascino@....com>,
Uladzislau Rezki <urezki@...il.com>, kasan-dev@...glegroups.com,
linux-mm@...ck.org, linux-kernel@...r.kernel.org, Adrian Huang
<ahuang12@...ovo.com>
Subject: Re: [PATCH 1/1] kasan, vmalloc: avoid lock contention when
depopulating vmalloc
On Wed, 25 Sep 2024 21:47:32 +0800 Adrian Huang <adrianhuang0701@...il.com> wrote:
>
> ...
>
> From: Adrian Huang <ahuang12@...ovo.com>
> After re-visiting code path about setting the kasan ptep (pte pointer),
> it's unlikely that a kasan ptep is set and cleared simultaneously by
> different CPUs. So, use ptep_get_and_clear() to get rid of the spinlock
> operation.
"unlikely" isn't particularly comforting. We'd prefer to never corrupt
pte's!
I'm suspecting we need a more thorough solution here.
btw, for a lame fix, did you try moving the spin_lock() into
kasan_release_vmalloc(), around the apply_to_existing_page_range()
call? That would at least reduce locking frequency a lot. Some
mitigation might be needed to avoid excessive hold times.
Powered by blists - more mailing lists