From: Uladzislau Rezki <urezki@gmail.com>
To: Joel Fernandes <joel@joelfernandes.org>
Cc: Uladzislau Rezki <urezki@gmail.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
rcu@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-team@fb.com, rostedt@goodmis.org
Subject: Re: [PATCH rcu 13/14] workqueue: Make queue_rcu_work() use call_rcu_flush()
Date: Tue, 25 Oct 2022 12:47:15 +0200 [thread overview]
Message-ID: <Y1e+s3gVPdRSrAWv@pc636> (raw)
In-Reply-To: <CAEXW_YSRkNDhJu591S3GGQyJnCxCDJy6u_+-1Q_8z5_cQHb1Qg@mail.gmail.com>
On Mon, Oct 24, 2022 at 04:08:17PM -0400, Joel Fernandes wrote:
> On Mon, Oct 24, 2022 at 1:40 PM Uladzislau Rezki <urezki@gmail.com> wrote:
> >
> > On Mon, Oct 24, 2022 at 01:20:26PM -0400, Joel Fernandes wrote:
> > > On Mon, Oct 24, 2022 at 1:08 PM Uladzislau Rezki <urezki@gmail.com> wrote:
> > > >
> > > > On Mon, Oct 24, 2022 at 06:55:16PM +0200, Uladzislau Rezki wrote:
> > > > > On Mon, Oct 24, 2022 at 09:48:19AM -0700, Paul E. McKenney wrote:
> > > > > > On Mon, Oct 24, 2022 at 06:25:30PM +0200, Uladzislau Rezki wrote:
> > > > > > > >
> > > > > > > > You guys might need to agree on the definition of "good" here. Or maybe
> > > > > > > > understand the differences in your respective platforms' definitions of
> > > > > > > > "good". ;-)
> > > > > > > >
> > > > > > > Indeed. Bad is when once per-millisecond infinitely :) At least in such use
> > > > > > > workload a can detect a power delta and power gain. Anyway, below is a new
> > > > > > > trace where i do not use "flush" variant for the kvfree_rcu():
> > > > > > >
> > > > > > > <snip>
> > > > > > > 1. Home screen swipe:
> > > > > > > rcuop/0-15 [003] d..1 1792.767750: rcu_batch_start: rcu_preempt CBs=1003 bl=10
> > > > > > > rcuop/2-33 [002] d..1 1792.771717: rcu_batch_start: rcu_preempt CBs=934 bl=10
> > > > > > > rcuop/3-40 [001] d..1 1794.811816: rcu_batch_start: rcu_preempt CBs=1508 bl=11
> > > > > > > rcuop/1-26 [003] d..1 1797.116382: rcu_batch_start: rcu_preempt CBs=2127 bl=16
> > > > > > > rcuop/4-48 [001] d..1 1797.124422: rcu_batch_start: rcu_preempt CBs=95 bl=10
> > > > > > > rcuop/5-55 [002] d..1 1797.124731: rcu_batch_start: rcu_preempt CBs=143 bl=10
> > > > > > > rcuop/6-62 [005] d..1 1798.911719: rcu_batch_start: rcu_preempt CBs=132 bl=10
> > > > > > > rcuop/2-33 [002] d..1 1803.003966: rcu_batch_start: rcu_preempt CBs=3797 bl=29
> > > > > > > rcuop/0-15 [003] d..1 1803.004707: rcu_batch_start: rcu_preempt CBs=2969 bl=23
> > >
> > > > > > > 2. App launches:
> > > > > > > rcuop/4-48 [005] d..1 1831.087612: rcu_batch_start: rcu_preempt CBs=6141 bl=47
> > > > > > > rcuop/7-69 [007] d..1 1831.095578: rcu_batch_start: rcu_preempt CBs=5464 bl=42
> > > > > > > rcuop/5-55 [004] d..1 1832.703571: rcu_batch_start: rcu_preempt CBs=8461 bl=66
> > > > > > > rcuop/0-15 [004] d..1 1833.731603: rcu_batch_start: rcu_preempt CBs=2548 bl=19
> > > > > > > rcuop/1-26 [006] d..1 1833.743691: rcu_batch_start: rcu_preempt CBs=2567 bl=20
> > > > > > > rcuop/2-33 [006] d..1 1833.744005: rcu_batch_start: rcu_preempt CBs=2359 bl=18
> > > > > > > rcuop/3-40 [006] d..1 1833.744286: rcu_batch_start: rcu_preempt CBs=3681 bl=28
> > > > > > > rcuop/4-48 [002] d..1 1838.079777: rcu_batch_start: rcu_preempt CBs=10444 bl=81
> > > > > > > rcuop/7-69 [001] d..1 1838.080375: rcu_batch_start: rcu_preempt CBs=12572 bl=98
> > > > > > > <...>-62 [002] d..1 1838.080646: rcu_batch_start: rcu_preempt CBs=14135 bl=110
> > > > > > > rcuop/6-62 [000] d..1 1838.087722: rcu_batch_start: rcu_preempt CBs=10839 bl=84
> > > > > > > <...>-62 [003] d..1 1839.227022: rcu_batch_start: rcu_preempt CBs=1834 bl=14
> > > > > > > <...>-26 [001] d..1 1839.963315: rcu_batch_start: rcu_preempt CBs=5769 bl=45
> > > > > > > rcuop/2-33 [001] d..1 1839.966485: rcu_batch_start: rcu_preempt CBs=3789 bl=29
> > > > > > > <...>-40 [001] d..1 1839.966596: rcu_batch_start: rcu_preempt CBs=6425 bl=50
> > > > > > > rcuop/2-33 [005] d..1 1840.541272: rcu_batch_start: rcu_preempt CBs=825 bl=10
> > > > > > > rcuop/2-33 [005] d..1 1840.547724: rcu_batch_start: rcu_preempt CBs=44 bl=10
> > > > > > > rcuop/2-33 [005] d..1 1841.075759: rcu_batch_start: rcu_preempt CBs=516 bl=10
> > > > > > > rcuop/0-15 [002] d..1 1841.695716: rcu_batch_start: rcu_preempt CBs=6312 bl=49
> > > > > > > rcuop/0-15 [003] d..1 1841.709714: rcu_batch_start: rcu_preempt CBs=39 bl=10
> > > > > > > rcuop/5-55 [004] d..1 1843.112442: rcu_batch_start: rcu_preempt CBs=16007 bl=125
> > > > > > > rcuop/5-55 [004] d..1 1843.115444: rcu_batch_start: rcu_preempt CBs=7901 bl=61
> > > > > > > rcuop/6-62 [001] dn.1 1843.123983: rcu_batch_start: rcu_preempt CBs=8427 bl=65
> > > > > > > rcuop/6-62 [006] d..1 1843.412383: rcu_batch_start: rcu_preempt CBs=981 bl=10
> > > > > > > rcuop/0-15 [003] d..1 1844.659812: rcu_batch_start: rcu_preempt CBs=1851 bl=14
> > > > > > > rcuop/0-15 [003] d..1 1844.667790: rcu_batch_start: rcu_preempt CBs=135 bl=10
> > >
> > > Definitely better, but I'd still ask why not just rely on the lazy
> > > batching that we now have, since it is a memory pressure related
> > > usecase. Or another approach could be, for CONFIG_RCU_LAZY, don't
> > > disturb the lazy-RCU batching by queuing these "free memory" CBs; and
> > > instead keep your improved kvfree_rcu() batching only for
> > > !CONFIG_RCU_LAZY.
> > >
> >
> > 1. Double-batching?
> >
> > The kvfree_rcu() interface itself keeps track of when to reclaim:
> > a) when a page is full;
> > b) when i high storm of freeing over rcu;
> > c) when a low memory condition.
> >
> > such control stays inside the kvfree_rcu(). Converting it to lazy
> > variant:
> > a) lose the control, what will become as a problem;
> > b) nothing is improved.
>
> AFAICS, the only thing being changed is when you are giving memory
> back to the system. So you will be holding on to memory a bit longer.
> And there's shrinkers that are already flushing those. I don't think
> the users of kvfree_rcu() want to free memory instantly. If there is
> such usecase, please share it.
>
Actually, ideally, we want to free a memory asap. The problem with extra 10
seconds is a big amount of un-reclaimed memory that usually can lead
to more frequent memory pressure and doing shrinking. We do not want
ideally trigger any shrinker. Because for us it is a big slow down
in a device behaviour.
> > 2. Converting the queue_rcu_work() to lazy variant breaks a humanity
> > interpretation when a queued work is supposed to be run. People do not
> > expect seconds when they queue the work.
>
> Which people? ;)
>
Who wrote the code :)
> > Same as in the kvfree_rcu()
> > we do not expect it we even used a high_prio queue in the beginning.
> > There are ~10 users who queue the work and they did not expect it to
> > be run in 10 seconds when they wrote the code.
>
> That's a bit of a misinterpretation of what I'm saying. A variant
> queue_rcu_work_flush() can be added for those users (such as ones that
> are not freeing memory).
>
If it is added for the kvfree_rcu() it is totally fine. Because there is
a batching in place.
--
Uladzislau Rezki
next prev parent reply other threads:[~2022-10-25 10:47 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-19 22:51 [PATCH rcu 0/14] Lazy call_rcu() updates for v6.2 Paul E. McKenney
2022-10-19 22:51 ` [PATCH rcu 01/14] rcu: Simplify rcu_init_nohz() cpumask handling Paul E. McKenney
2022-10-19 22:51 ` [PATCH rcu 02/14] rcu: Fix late wakeup when flush of bypass cblist happens Paul E. McKenney
2022-10-19 22:51 ` [PATCH rcu 03/14] rcu: Fix missing nocb gp wake on rcu_barrier() Paul E. McKenney
2022-10-19 22:51 ` [PATCH rcu 04/14] rcu: Make call_rcu() lazy to save power Paul E. McKenney
2022-10-19 22:51 ` [PATCH rcu 05/14] rcu: Refactor code a bit in rcu_nocb_do_flush_bypass() Paul E. McKenney
2022-10-19 22:51 ` [PATCH rcu 06/14] rcu: Shrinker for lazy rcu Paul E. McKenney
2022-10-19 22:51 ` [PATCH rcu 07/14] rcuscale: Add laziness and kfree tests Paul E. McKenney
2022-10-19 22:51 ` [PATCH rcu 08/14] percpu-refcount: Use call_rcu_flush() for atomic switch Paul E. McKenney
2022-10-19 22:51 ` [PATCH rcu 09/14] rcu/sync: Use call_rcu_flush() instead of call_rcu Paul E. McKenney
2022-10-19 22:51 ` [PATCH rcu 10/14] rcu/rcuscale: Use call_rcu_flush() for async reader test Paul E. McKenney
2022-10-19 22:51 ` [PATCH rcu 11/14] rcu/rcutorture: Use call_rcu_flush() where needed Paul E. McKenney
2022-10-19 22:51 ` [PATCH rcu 12/14] scsi/scsi_error: Use call_rcu_flush() instead of call_rcu() Paul E. McKenney
2022-10-19 22:51 ` [PATCH rcu 13/14] workqueue: Make queue_rcu_work() use call_rcu_flush() Paul E. McKenney
2022-10-24 0:36 ` Joel Fernandes
2022-10-24 3:15 ` Paul E. McKenney
2022-10-24 10:49 ` Uladzislau Rezki
2022-10-24 12:23 ` Uladzislau Rezki
2022-10-24 14:31 ` Joel Fernandes
2022-10-24 15:39 ` Paul E. McKenney
2022-10-24 16:25 ` Uladzislau Rezki
2022-10-24 16:48 ` Paul E. McKenney
2022-10-24 16:55 ` Uladzislau Rezki
2022-10-24 17:08 ` Uladzislau Rezki
2022-10-24 17:20 ` Joel Fernandes
2022-10-24 17:35 ` Paul E. McKenney
2022-10-24 20:12 ` Joel Fernandes
2022-10-24 20:16 ` Joel Fernandes
2022-10-25 10:48 ` Uladzislau Rezki
2022-10-25 15:05 ` Joel Fernandes
2022-10-26 20:35 ` Uladzislau Rezki
2022-10-24 20:19 ` Paul E. McKenney
2022-10-24 20:26 ` Joel Fernandes
2022-10-24 17:40 ` Uladzislau Rezki
2022-10-24 20:08 ` Joel Fernandes
2022-10-25 10:47 ` Uladzislau Rezki [this message]
2022-10-28 21:23 ` Joel Fernandes
2022-10-28 21:42 ` Joel Fernandes
2022-10-31 13:21 ` Uladzislau Rezki
2022-10-31 13:37 ` Joel Fernandes
2022-10-31 18:15 ` Joel Fernandes
2022-11-01 4:49 ` Uladzislau Rezki
2022-10-24 16:54 ` Joel Fernandes
2022-10-19 22:51 ` [PATCH rcu 14/14] rxrpc: Use call_rcu_flush() instead of call_rcu() Paul E. McKenney
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=Y1e+s3gVPdRSrAWv@pc636 \
--to=urezki@gmail.com \
--cc=joel@joelfernandes.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.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 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.