From: Jesper Dangaard Brouer <hawk@kernel.org>
To: Yosry Ahmed <yosryahmed@google.com>
Cc: tj@kernel.org, cgroups@vger.kernel.org, shakeel.butt@linux.dev,
hannes@cmpxchg.org, lizefan.x@bytedance.com, longman@redhat.com,
kernel-team@cloudflare.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH V8 1/2] cgroup/rstat: Avoid flushing if there is an ongoing overlapping flush
Date: Tue, 30 Jul 2024 22:15:16 +0200 [thread overview]
Message-ID: <3fd88047-db3f-4165-9b58-fdeb5413c1a6@kernel.org> (raw)
In-Reply-To: <CAJD7tkaZuiSCj4RZ2v6jOCtwiv++YNQxA0x6MEp-HrHaYO6_9g@mail.gmail.com>
On 30/07/2024 20.54, Yosry Ahmed wrote:
> [..]
>>>> +static inline void __cgroup_rstat_lock(struct cgroup *cgrp, int cpu_in_loop,
>>>> + bool already_contended)
>>>> __acquires(&cgroup_rstat_lock)
>>>> {
>>>> - bool contended;
>>>> + bool locked = false;
>>>>
>>>> - contended = !spin_trylock_irq(&cgroup_rstat_lock);
>>>> - if (contended) {
>>>> - trace_cgroup_rstat_lock_contended(cgrp, cpu_in_loop, contended);
>>>> + if (already_contended) /* Skip trylock if already contended */
>>>> + locked = __cgroup_rstat_trylock(cgrp, cpu_in_loop);
>>> Should this be the other way around?
>>>
>> I think it is correct, but I used it wrong in once place, in
>> cgroup_rstat_flush_hold(), as cgroup_rstat_trylock_flusher() returning
>> false doesn't mean it was already_contended, but that ongoing flusher
>> "skipped" (and waited for) a flush. I need to correct this.
>
> Something isn't adding up here as well. The comment says skip trylock
> if already contended, then if already_contended is true we do a
> trylock. Am I confusing myself here? 🙂
Your are correct. Thanks you for spelling it out for me!
I will send a V9 tomorrow, then deploy it to my prod experiment hosts,
and retest as I think my mistake here affects the prod results, as some
of the tracepoints gets skipped due to this.
Again thanks for catching this!!!
--Jesper
next prev parent reply other threads:[~2024-07-30 20:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-19 13:06 [PATCH V8 1/2] cgroup/rstat: Avoid flushing if there is an ongoing overlapping flush Jesper Dangaard Brouer
2024-07-19 13:07 ` [PATCH V8 2/2] cgroup/rstat: add tracepoints for ongoing flusher waits Jesper Dangaard Brouer
2024-07-22 17:02 ` [PATCH V8 1/2] cgroup/rstat: Avoid flushing if there is an ongoing overlapping flush Yosry Ahmed
2024-07-30 16:50 ` Jesper Dangaard Brouer
2024-07-30 18:54 ` Yosry Ahmed
2024-07-30 20:15 ` Jesper Dangaard Brouer [this message]
2024-08-02 11:43 ` Jesper Dangaard Brouer
2024-08-02 16:10 ` Yosry Ahmed
2024-08-05 14:23 ` Jesper Dangaard Brouer
2024-08-05 18:50 ` Yosry Ahmed
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=3fd88047-db3f-4165-9b58-fdeb5413c1a6@kernel.org \
--to=hawk@kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@cloudflare.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lizefan.x@bytedance.com \
--cc=longman@redhat.com \
--cc=shakeel.butt@linux.dev \
--cc=tj@kernel.org \
--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 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).