[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y5BIHdnP4yeJ8svL@linutronix.de>
Date: Wed, 7 Dec 2022 09:00:29 +0100
From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To: "Fabio M. De Francesco" <fmdefrancesco@...il.com>
Cc: Jonathan Corbet <corbet@....net>,
Andrew Morton <akpm@...ux-foundation.org>,
Ira Weiny <ira.weiny@...el.com>,
Mike Rapoport <rppt@...nel.org>, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Mike Rapoport <rppt@...ux.ibm.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH] mm/highmem: Add notes about conversions from
kmap{,_atomic}()
On 2022-12-06 20:12:13 [+0100], Fabio M. De Francesco wrote:
> > Furthermore, code between the kmap_atomic() and kunmap_atomic()
> > functions may implicitly depended
>
> I suppose it should be "depend"? Shouldn't it?
Ehm, yes, correct.
> > on the side effects of kmap_atomic()
> > namely disabling pagefaults or preemption or both.
>
> I agree with you for rephrasing, mainly because it is
> written in poor English.
>
> However, I still have doubts about why you deleted "migration".
> AFAIK, __kmap_local_pfn_prot() always takes care of disabling migration for
> HIGHMEM enabled kernels.
That is correct. Historically kmap_atomic() never had a
migrate_disable() statement - only preempt_disable(). With disabled
preemption the task migration is implicitly disabled.
> How about !HIGHMEM, where kmap_local_page() is an indirect call to
> page_address()? Did you mean that, if the code between kmap_atomic() and
> kunmap_atomic() depended on migrate_disable() (in PREEMPT_RT) we should always
> just stay safe and call preempt_disable() together with conversion to
> kmap_local_page()?
Even in the !HIGHMEM case it always uses preempt_disable(). With
PREEMPT_RT it is different as it never disabled preemption and always
did a migrate_disable() instead. If you talk about what needs to be
considered while migrating away from kmap_atomic() then I wouldn't add
the PREEMPT_RT bits to it since it was never in the picture while the
code (using kmap_atomic()) was originally written.
> If so, I understand and I again agree with you. If not, I'm missing something;
> so please let me understand properly.
>
> Aside from the above, I'm not sure whether you deleted the last phrase before
> your suggestion. What about making it to become "For the above-mentioned
> cases, conversions should also explicitly disable page-faults and/or
> preemption"?
They need to disable preemption or page-faults or both if it is needed
(not unconditionally) and where it is needed. This means not
unconditionally over the whole kmap-ed section.
> Thanks again for noticing my mistakes.
>
> Fabio
Sebastian
Powered by blists - more mailing lists