From: Uladzislau Rezki <urezki@gmail.com>
To: huang ying <huang.ying.caritas@gmail.com>
Cc: "Uladzislau Rezki (Sony)" <urezki@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>,
Hillf Danton <hdanton@sina.com>, Michal Hocko <mhocko@suse.com>,
Matthew Wilcox <willy@infradead.org>,
Oleksiy Avramchenko <oleksiy.avramchenko@sonymobile.com>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH 2/2] mm/vmalloc: rework the drain logic
Date: Tue, 17 Nov 2020 14:04:34 +0100 [thread overview]
Message-ID: <20201117130434.GA10769@pc636> (raw)
In-Reply-To: <CAC=cRTN77LAn-9-6rGukc2aUZQzx7oP9eKt_hJeb=wbnhGqObQ@mail.gmail.com>
On Tue, Nov 17, 2020 at 10:37:34AM +0800, huang ying wrote:
> On Tue, Nov 17, 2020 at 6:00 AM Uladzislau Rezki (Sony)
> <urezki@gmail.com> wrote:
> >
> > A current "lazy drain" model suffers from at least two issues.
> >
> > First one is related to the unsorted list of vmap areas, thus
> > in order to identify the [min:max] range of areas to be drained,
> > it requires a full list scan. What is a time consuming if the
> > list is too long.
> >
> > Second one and as a next step is about merging all fragments
> > with a free space. What is also a time consuming because it
> > has to iterate over entire list which holds outstanding lazy
> > areas.
> >
> > See below the "preemptirqsoff" tracer that illustrates a high
> > latency. It is ~24 676us. Our workloads like audio and video
> > are effected by such long latency:
>
> This seems like a real problem. But I found there's long latency
> avoidance mechanism in the loop in __purge_vmap_area_lazy() as
> follows,
>
> if (atomic_long_read(&vmap_lazy_nr) < resched_threshold)
> cond_resched_lock(&free_vmap_area_lock);
>
I have added that "resched threshold" because of on my tests i could
simply hit out of memory, due to the fact that a drain work is not up
to speed to process such long outstanding list of vmap areas.
>
> If it works properly, the latency problem can be solved. Can you
> check whether this doesn't work for you?
>
We have that cond_resched_lock() in our products. The patch that is
in question creates bigger vmap areas on early step(merge them), so
the final structure becomes less fragmented, what speeds up a drain
logic, thus reduces a preemption off time.
Apart of that, high priority tasks like RT or DL which are users of
the vmalloc()/vfree() can start draining process from its contexts,
what is also a problem. In that sense, i think we need to make the
vfree() call to be asynchronous, so latency sensitive tasks and others
do not perform any draining from their contexts.
--
Vlad Rezki
next prev parent reply other threads:[~2020-11-17 13:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-16 22:00 [PATCH 1/2] mm/vmalloc: use free_vm_area() if an allocation fails Uladzislau Rezki (Sony)
2020-11-16 22:00 ` [PATCH 2/2] mm/vmalloc: rework the drain logic Uladzislau Rezki (Sony)
2020-11-17 2:37 ` huang ying
2020-11-17 13:04 ` Uladzislau Rezki [this message]
2020-11-18 2:44 ` huang ying
2020-11-18 16:16 ` Uladzislau Rezki
2020-11-19 1:40 ` Huang, Ying
2020-11-19 17:36 ` Uladzislau Rezki
2020-11-20 2:34 ` Huang, Ying
2020-11-23 13:59 ` Uladzislau Rezki
2020-11-24 2:25 ` Huang, Ying
2020-11-24 16:40 ` Uladzislau Rezki
2020-11-25 0:52 ` Huang, Ying
2020-11-25 20:34 ` Uladzislau Rezki
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=20201117130434.GA10769@pc636 \
--to=urezki@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hdanton@sina.com \
--cc=huang.ying.caritas@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=oleksiy.avramchenko@sonymobile.com \
--cc=rostedt@goodmis.org \
--cc=willy@infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).