From: Michal Hocko <mhocko@suse.com>
To: Wei Xu <weixugc@google.com>
Cc: "Yosry Ahmed" <yosryahmed@google.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Johannes Weiner" <hannes@cmpxchg.org>,
"Roman Gushchin" <roman.gushchin@linux.dev>,
"Shakeel Butt" <shakeelb@google.com>,
"Muchun Song" <muchun.song@linux.dev>,
"Ivan Babrou" <ivan@cloudflare.com>, "Tejun Heo" <tj@kernel.org>,
"Michal Koutný" <mkoutny@suse.com>,
"Waiman Long" <longman@redhat.com>,
linux-mm@kvack.org, cgroups@vger.kernel.org,
linux-kernel@vger.kernel.org, "Greg Thelen" <gthelen@google.com>
Subject: Re: [PATCH v4 4/4] mm: memcg: use non-unified stats flushing for userspace reads
Date: Mon, 11 Sep 2023 21:34:14 +0200 [thread overview]
Message-ID: <ZP9rtiRwRv2bQvde@dhcp22.suse.cz> (raw)
In-Reply-To: <CAAPL-u8NndkB2zHRtF8pVBSTsz854YmUbx62G7bpw6BMJiLaiQ@mail.gmail.com>
On Mon 11-09-23 12:15:24, Wei Xu wrote:
> On Mon, Sep 11, 2023 at 6:11 AM Michal Hocko <mhocko@suse.com> wrote:
> >
> > On Thu 07-09-23 17:52:12, Wei Xu wrote:
> > [...]
> > > I tested this patch on a machine with 384 CPUs using a microbenchmark
> > > that spawns 10K threads, each reading its memory.stat every 100
> > > milliseconds.
> >
> > This is rather extreme case but I wouldn't call it utterly insane
> > though.
> >
> > > Most of memory.stat reads take 5ms-10ms in kernel, with
> > > ~5% reads even exceeding 1 second.
> >
> > Just curious, what would numbers look like if the mutex is removed and
> > those threads would be condending on the existing spinlock with lock
> > dropping in place and removed. Would you be willing to give it a shot?
>
> Without the mutex and with the spinlock only, the common read latency
> of memory.stat is still 5ms-10ms in kernel. There are very few reads
> (<0.003%) going above 10ms and none more than 1 second.
Is this with the existing spinlock dropping and same 10k potentially
contending readers?
--
Michal Hocko
SUSE Labs
WARNING: multiple messages have this Message-ID (diff)
From: Michal Hocko <mhocko@suse.com>
To: Wei Xu <weixugc@google.com>
Cc: "Yosry Ahmed" <yosryahmed@google.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Johannes Weiner" <hannes@cmpxchg.org>,
"Roman Gushchin" <roman.gushchin@linux.dev>,
"Shakeel Butt" <shakeelb@google.com>,
"Muchun Song" <muchun.song@linux.dev>,
"Ivan Babrou" <ivan@cloudflare.com>, "Tejun Heo" <tj@kernel.org>,
"Michal Koutný" <mkoutny@suse.com>,
"Waiman Long" <longman@redhat.com>,
linux-mm@kvack.org, cgroups@vger.kernel.org,
linux-kernel@vger.kernel.org, "Greg Thelen" <gthelen@google.com>
Subject: Re: [PATCH v4 4/4] mm: memcg: use non-unified stats flushing for userspace reads
Date: Mon, 11 Sep 2023 21:34:14 +0200 [thread overview]
Message-ID: <ZP9rtiRwRv2bQvde@dhcp22.suse.cz> (raw)
In-Reply-To: <CAAPL-u8NndkB2zHRtF8pVBSTsz854YmUbx62G7bpw6BMJiLaiQ@mail.gmail.com>
On Mon 11-09-23 12:15:24, Wei Xu wrote:
> On Mon, Sep 11, 2023 at 6:11 AM Michal Hocko <mhocko@suse.com> wrote:
> >
> > On Thu 07-09-23 17:52:12, Wei Xu wrote:
> > [...]
> > > I tested this patch on a machine with 384 CPUs using a microbenchmark
> > > that spawns 10K threads, each reading its memory.stat every 100
> > > milliseconds.
> >
> > This is rather extreme case but I wouldn't call it utterly insane
> > though.
> >
> > > Most of memory.stat reads take 5ms-10ms in kernel, with
> > > ~5% reads even exceeding 1 second.
> >
> > Just curious, what would numbers look like if the mutex is removed and
> > those threads would be condending on the existing spinlock with lock
> > dropping in place and removed. Would you be willing to give it a shot?
>
> Without the mutex and with the spinlock only, the common read latency
> of memory.stat is still 5ms-10ms in kernel. There are very few reads
> (<0.003%) going above 10ms and none more than 1 second.
Is this with the existing spinlock dropping and same 10k potentially
contending readers?
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2023-09-11 19:34 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-31 16:56 [PATCH v4 0/4] memcg: non-unified flushing for userspace stats Yosry Ahmed
2023-08-31 16:56 ` Yosry Ahmed
2023-08-31 16:56 ` [PATCH v4 1/4] mm: memcg: properly name and document unified stats flushing Yosry Ahmed
[not found] ` <20230831165611.2610118-2-yosryahmed-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2023-09-04 14:44 ` Michal Hocko
2023-09-04 14:44 ` Michal Hocko
[not found] ` <ZPXtVLNIXk8trj2k-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2023-09-05 15:55 ` Yosry Ahmed
2023-09-05 15:55 ` Yosry Ahmed
2023-08-31 16:56 ` [PATCH v4 3/4] mm: memcg: let non-unified root stats flushes help unified flushes Yosry Ahmed
2023-08-31 16:56 ` Yosry Ahmed
2023-09-04 14:50 ` Michal Hocko
[not found] ` <ZPXupwjewuLgksAI-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2023-09-04 15:29 ` Michal Koutný
2023-09-04 15:29 ` Michal Koutný
2023-09-04 15:41 ` Michal Hocko
2023-09-04 15:41 ` Michal Hocko
[not found] ` <ZPX6luPGqypp68+L-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2023-09-05 14:10 ` Michal Koutný
2023-09-05 14:10 ` Michal Koutný
2023-09-05 15:54 ` Yosry Ahmed
2023-09-05 15:54 ` Yosry Ahmed
[not found] ` <CAJD7tkaHVtMiMYFocNiABuyhPcqt77gei0UeaDq4J7V-=tMFYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-09-05 16:07 ` Michal Koutný
2023-09-05 16:07 ` Michal Koutný
2023-09-12 11:03 ` Michal Hocko
2023-09-12 11:03 ` Michal Hocko
[not found] ` <20230831165611.2610118-1-yosryahmed-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2023-08-31 16:56 ` [PATCH v4 2/4] mm: memcg: add a helper for non-unified stats flushing Yosry Ahmed
2023-08-31 16:56 ` Yosry Ahmed
[not found] ` <20230831165611.2610118-3-yosryahmed-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2023-09-04 14:45 ` Michal Hocko
2023-09-04 14:45 ` Michal Hocko
2023-08-31 16:56 ` [PATCH v4 4/4] mm: memcg: use non-unified stats flushing for userspace reads Yosry Ahmed
2023-08-31 16:56 ` Yosry Ahmed
[not found] ` <20230831165611.2610118-5-yosryahmed-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2023-09-04 15:15 ` Michal Hocko
2023-09-04 15:15 ` Michal Hocko
[not found] ` <ZPX0kCKd4TaVLJY7-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2023-09-05 15:57 ` Yosry Ahmed
2023-09-05 15:57 ` Yosry Ahmed
2023-09-08 0:52 ` Wei Xu
2023-09-08 0:52 ` Wei Xu
[not found] ` <CAAPL-u9D2b=iF5Lf_cRnKxUfkiEe0AMDTu6yhrUAzX0b6a6rDg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-09-08 1:02 ` Ivan Babrou
2023-09-08 1:02 ` Ivan Babrou
[not found] ` <CABWYdi1WNp9f20nRFEExn8QB1MwP7QXwvD6Q8xHHuTO2SUTLkA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-09-08 1:11 ` Yosry Ahmed
2023-09-08 1:11 ` Yosry Ahmed
2023-09-11 13:11 ` Michal Hocko
2023-09-11 19:15 ` Wei Xu
2023-09-11 19:15 ` Wei Xu
2023-09-11 19:34 ` Michal Hocko [this message]
2023-09-11 19:34 ` Michal Hocko
2023-09-11 20:01 ` Wei Xu
2023-09-11 20:21 ` Tejun Heo
2023-09-11 20:28 ` Yosry Ahmed
2023-09-11 20:28 ` Yosry Ahmed
[not found] ` <ZP92xP5rdKdeps7Z-qYNAdHglDFBN0TnZuCh8vA@public.gmane.org>
2023-09-12 11:03 ` Michal Hocko
2023-09-12 11:03 ` Michal Hocko
[not found] ` <ZQBFZMRL8WmqRgrM-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2023-09-12 11:09 ` Yosry Ahmed
2023-09-12 11:09 ` Yosry Ahmed
2023-08-31 17:18 ` [PATCH v4 0/4] memcg: non-unified flushing for userspace stats Waiman Long
2023-08-31 17:18 ` 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=ZP9rtiRwRv2bQvde@dhcp22.suse.cz \
--to=mhocko@suse.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=gthelen@google.com \
--cc=hannes@cmpxchg.org \
--cc=ivan@cloudflare.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=longman@redhat.com \
--cc=mkoutny@suse.com \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=shakeelb@google.com \
--cc=tj@kernel.org \
--cc=weixugc@google.com \
--cc=yosryahmed@google.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.