Re: [PATCH] mm: vmalloc: Use the vmap_area_lock to protect ne_fit_preload_node

From: Uladzislau Rezki
Date: Mon Oct 07 2019 - 12:56:23 EST


On Mon, Oct 07, 2019 at 06:34:43PM +0200, Daniel Wagner wrote:
> On Mon, Oct 07, 2019 at 06:23:30PM +0200, Uladzislau Rezki wrote:
> > Hello, Daniel, Sebastian.
> >
> > > > On Fri, Oct 04, 2019 at 06:30:42PM +0200, Sebastian Andrzej Siewior wrote:
> > > > > On 2019-10-04 18:20:41 [+0200], Uladzislau Rezki wrote:
> > > > > > If we have migrate_disable/enable, then, i think preempt_enable/disable
> > > > > > should be replaced by it and not the way how it has been proposed
> > > > > > in the patch.
> > > > >
> > > > > I don't think this patch is appropriate for upstream.
> > > >
> > > > Yes, I agree. The discussion made this clear, this is only for -rt
> > > > trees. Initially I though this should be in mainline too.
> > >
> > > Sorry, this was _before_ Uladzislau pointed out that you *just* moved
> > > the lock that was there from the beginning. I missed that while looking
> > > over the patch. Based on that I don't think that this patch is not
> > > appropriate for upstream.
> > >
> > Yes that is a bit messy :) Then i do not see what that patch fixes in
> > mainline? Instead it will just add an extra blocking, i did not want that
> > therefore used preempt_enable/disable. But, when i saw this patch i got it
> > as a preparation of PREEMPT_RT merging work.
>
> Maybe I should add some background info here as well. Currently, I am
> creating an -rt tree on v5.3 for which I need this patch (or a
> migrate_disable() version of it). So this is slightly independent of
> the work Sebiastian is doing. Though the mainline effort of PREEMPT_RT
> will hit this problem as well.
>
> I understood Sebiastian wrong above. I thought he suggest to use the
> migrate_disable() approach even for mainline.
>
> I supppose, one thing which would help in this discussion, is what do
> you gain by using preempt_disable() instead of moving the lock up?
> Do you have performance numbers which could justify the code?
>
Actually there is a high lock contention on vmap_area_lock, because it
is still global. You can have a look at last slide:

https://linuxplumbersconf.org/event/4/contributions/547/attachments/287/479/Reworking_of_KVA_allocator_in_Linux_kernel.pdf

so this change will make it a bit higher. From the other hand i agree
that for rt it should be fixed, probably it could be done like:

ifdef PREEMPT_RT
migrate_disable()
#else
preempt_disable()
...

but i am not sure it is good either.

--
Vlad Rezki