From: Baoquan He <bhe@redhat.com>
To: Waiman Long <longman@redhat.com>, Zhipeng Shi <zhipeng.shi0@gmail.com>
Cc: linux-mm@kvack.org, linux-rt-users@vger.kernel.org,
tglx@linutronix.de, shengjian.xu@horizon.ai, schspa@gmail.com,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
peterz@infradead.org
Subject: Re: [Question] vmalloc latency in RT-Linux
Date: Fri, 24 Jun 2022 10:39:43 +0800 [thread overview]
Message-ID: <YrUj70P1sYFXsnqf@MiWiFi-R3L-srv> (raw)
In-Reply-To: <dd4f2422-3151-2c0b-e4c6-fe49f6d2ac30@redhat.com>
On 06/23/22 at 02:04pm, Waiman Long wrote:
> On 6/23/22 06:51, Baoquan He wrote:
> > On 06/21/22 at 08:15pm, Zhipeng Shi wrote:
> > > I noticed in rt-linux, vmalloc has a large latency. This is because the
> > > free_vmap_area_lock is held for a long time in the function
> > > __purge_vmap_area_lazy.
> > >
> > > In non-RT-Linux, because the function spin_is_contended is well
> > > implemented, so there will be no such problem.
> > >
> > > But in RT-Linux, spin_is_contended simply returns 0. I don't understand
> > > why this function was implemented like this before, but in order to
> > > solve this problem, I thought of two ways.
> > >
> > > The first is to modify the spin_is_contended definition in spinlock_rt.h
> > > as shown below, but I'm not sure if the change has side-effects:
> > >
> > > -#define spin_is_contended(lock) (((void)(lock), 0))
> > > +static inline int spin_is_contended(spinlock_t *lock)
> > > +{
> > > + unsigned long *p = (unsigned long *) &lock->lock.owner;
> > > +
> > > + return (READ_ONCE(*p) & RT_MUTEX_HAS_WAITERS);
> > > +}
> > >
> > > The second is by reducing the number of lazy_max_pages, but it will lead
> > > to lower performance of vmalloc.
> > __purge_vmap_area_lazy() has cond_resched_lock() to reschedule and drop
> > the lock. From your saying, it's spin_is_contended() which is not
> > working well to make rescheduling happen during __purge_vmap_area_lazy()
> > handling. Then the fixing should be done in lock side.
>
> Sebastian had sent out patch last year to fix spin_is_contended().
>
> https://lore.kernel.org/lkml/20210906143004.2259141-3-bigeasy@linutronix.de/
>
> However, there is no follow-up after some discussion and the patch wasn't
> merged.
That's great. Thanks, Longman.
Then this is a good chance to reconsider it, maybe with a test from Zhipeng.
next prev parent reply other threads:[~2022-06-24 2:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-21 12:15 [Question] vmalloc latency in RT-Linux Zhipeng Shi
2022-06-23 10:51 ` Baoquan He
2022-06-23 18:04 ` Waiman Long
2022-06-24 2:39 ` Baoquan He [this message]
2022-06-24 5:56 ` Zhipeng Shi
2022-06-24 6:46 ` Sebastian Andrzej Siewior
2022-06-25 2:27 ` Waiman Long
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=YrUj70P1sYFXsnqf@MiWiFi-R3L-srv \
--to=bhe@redhat.com \
--cc=bigeasy@linutronix.de \
--cc=linux-mm@kvack.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=longman@redhat.com \
--cc=peterz@infradead.org \
--cc=schspa@gmail.com \
--cc=shengjian.xu@horizon.ai \
--cc=tglx@linutronix.de \
--cc=zhipeng.shi0@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.