[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8ac1d420-b861-f586-bacf-8c3949e9b5c4@kernel.org>
Date: Tue, 8 Jun 2021 09:20:05 -0700
From: Andy Lutomirski <luto@...nel.org>
To: Nicholas Piggin <npiggin@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Randy Dunlap <rdunlap@...radead.org>, linux-kernel@...r.kernel.org,
linux-arch@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
linux-mm@...ck.org, Anton Blanchard <anton@...abs.org>
Subject: Re: [PATCH v4 2/4] lazy tlb: allow lazy tlb mm refcounting to be
configurable
On 6/4/21 6:42 PM, Nicholas Piggin wrote:
> Add CONFIG_MMU_TLB_REFCOUNT which enables refcounting of the lazy tlb mm
> when it is context switched. This can be disabled by architectures that
> don't require this refcounting if they clean up lazy tlb mms when the
> last refcount is dropped. Currently this is always enabled, which is
> what existing code does, so the patch is effectively a no-op.
>
> Rename rq->prev_mm to rq->prev_lazy_mm, because that's what it is.
I am in favor of this approach, but I would be a lot more comfortable
with the resulting code if task->active_mm were at least better
documented and possibly even guarded by ifdefs.
x86 bare metal currently does not need the core lazy mm refcounting, and
x86 bare metal *also* does not need ->active_mm. Under the x86 scheme,
if lazy mm refcounting were configured out, ->active_mm could become a
dangling pointer, and this makes me extremely uncomfortable.
So I tend to think that, depending on config, the core code should
either keep ->active_mm [1] alive or get rid of it entirely.
[1] I don't really think it belongs in task_struct at all. It's not a
property of the task. It's the *per-cpu* mm that the core code is
keeping alive for lazy purposes. How about consolidating it with the
copy in rq?
I guess the short summary of my opinion is that I like making this
configurable, but I do not like the state of the code.
--Andy
Powered by blists - more mailing lists