[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZMEuPoKQ0cb+iMtl@tpad>
Date: Wed, 26 Jul 2023 11:31:26 -0300
From: Marcelo Tosatti <mtosatti@...hat.com>
To: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Christian Brauner <brauner@...nel.org>
Cc: Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>,
Matthew Wilcox <willy@...radead.org>,
Christoph Hellwig <hch@....de>, Jens Axboe <axboe@...nel.dk>,
Frederic Weisbecker <frederic@...nel.org>,
Dave Chinner <david@...morbit.com>,
Valentin Schneider <vschneid@...hat.com>,
Leonardo Bras <leobras@...hat.com>,
Yair Podemsky <ypodemsk@...hat.com>, P J P <ppandit@...hat.com>
Subject: Re: [PATCH] fs/buffer.c: disable per-CPU buffer_head cache for
isolated CPUs
Ping, apparently there is no objection to this patch...
Christian, what is the preferred tree for integration?
On Tue, Jun 27, 2023 at 05:08:15PM -0300, Marcelo Tosatti wrote:
>
> For certain types of applications (for example PLC software or
> RAN processing), upon occurrence of an event, it is necessary to
> complete a certain task in a maximum amount of time (deadline).
>
> One way to express this requirement is with a pair of numbers,
> deadline time and execution time, where:
>
> * deadline time: length of time between event and deadline.
> * execution time: length of time it takes for processing of event
> to occur on a particular hardware platform
> (uninterrupted).
>
> The particular values depend on use-case. For the case
> where the realtime application executes in a virtualized
> guest, an IPI which must be serviced in the host will cause
> the following sequence of events:
>
> 1) VM-exit
> 2) execution of IPI (and function call)
> 3) VM-entry
>
> Which causes an excess of 50us latency as observed by cyclictest
> (this violates the latency requirement of vRAN application with 1ms TTI,
> for example).
>
> invalidate_bh_lrus calls an IPI on each CPU that has non empty
> per-CPU cache:
>
> on_each_cpu_cond(has_bh_in_lru, invalidate_bh_lru, NULL, 1);
>
> The performance when using the per-CPU LRU cache is as follows:
>
> 42 ns per __find_get_block
> 68 ns per __find_get_block_slow
>
> Given that the main use cases for latency sensitive applications
> do not involve block I/O (data necessary for program operation is
> locked in RAM), disable per-CPU buffer_head caches for isolated CPUs.
>
> Signed-off-by: Marcelo Tosatti <mtosatti@...hat.com>
>
> diff --git a/fs/buffer.c b/fs/buffer.c
> index a7fc561758b1..49e9160ce100 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -49,6 +49,7 @@
> #include <trace/events/block.h>
> #include <linux/fscrypt.h>
> #include <linux/fsverity.h>
> +#include <linux/sched/isolation.h>
>
> #include "internal.h"
>
> @@ -1289,7 +1290,7 @@ static void bh_lru_install(struct buffer_head *bh)
> * failing page migration.
> * Skip putting upcoming bh into bh_lru until migration is done.
> */
> - if (lru_cache_disabled()) {
> + if (lru_cache_disabled() || cpu_is_isolated(smp_processor_id())) {
> bh_lru_unlock();
> return;
> }
> @@ -1319,6 +1320,10 @@ lookup_bh_lru(struct block_device *bdev, sector_t block, unsigned size)
>
> check_irqs_on();
> bh_lru_lock();
> + if (cpu_is_isolated(smp_processor_id())) {
> + bh_lru_unlock();
> + return NULL;
> + }
> for (i = 0; i < BH_LRU_SIZE; i++) {
> struct buffer_head *bh = __this_cpu_read(bh_lrus.bhs[i]);
>
Powered by blists - more mailing lists