* [RFC PATCH v2 0/3] Move usages of struct __call_single_data to call_single_data_t
@ 2023-05-20 5:29 Leonardo Bras
2023-05-20 5:29 ` [RFC PATCH v2 1/3] blk-mq: Move csd inside struct request so it's 32-byte aligned Leonardo Bras
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Leonardo Bras @ 2023-05-20 5:29 UTC (permalink / raw)
To: Jens Axboe, Peter Zijlstra, Josh Poimboeuf, Palmer Dabbelt,
Leonardo Bras, Guo Ren, Valentin Schneider, Paul E. McKenney,
Juergen Gross, Yury Norov, Marcelo Tosatti
Cc: linux-block, linux-kernel
Changes since RFCv1:
- request->csd moved to the middle of the struct, without size impact
- type change happens in a different patch (thanks Jens Axboe!)
- Improved the third patch to also update the .h file.
Leonardo Bras (3):
blk-mq: Move csd inside struct request so it's 32-byte aligned
blk-mq: Change request->csd type to call_single_data_t
smp: Change signatures to use call_single_data_t
include/linux/blk-mq.h | 10 +++++-----
include/linux/smp.h | 2 +-
kernel/smp.c | 4 ++--
kernel/up.c | 2 +-
4 files changed, 9 insertions(+), 9 deletions(-)
--
2.40.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [RFC PATCH v2 1/3] blk-mq: Move csd inside struct request so it's 32-byte aligned
2023-05-20 5:29 [RFC PATCH v2 0/3] Move usages of struct __call_single_data to call_single_data_t Leonardo Bras
@ 2023-05-20 5:29 ` Leonardo Bras
2023-05-20 5:29 ` [RFC PATCH v2 2/3] blk-mq: Change request->csd type to call_single_data_t Leonardo Bras
` (2 subsequent siblings)
3 siblings, 0 replies; 11+ messages in thread
From: Leonardo Bras @ 2023-05-20 5:29 UTC (permalink / raw)
To: Jens Axboe, Peter Zijlstra, Josh Poimboeuf, Palmer Dabbelt,
Leonardo Bras, Guo Ren, Valentin Schneider, Paul E. McKenney,
Juergen Gross, Yury Norov, Marcelo Tosatti
Cc: linux-block, linux-kernel
Currently, request->csd has type struct __call_single_data.
call_single_data_t is defined in include/linux/smp.h :
/* Use __aligned() to avoid to use 2 cache lines for 1 csd */
typedef struct __call_single_data call_single_data_t
__aligned(sizeof(struct __call_single_data));
As the comment above the typedef suggests, having struct __call_single_data
split between 2 cachelines causes the need to fetch / invalidate / bounce 2
cachelines instead of 1 when the cpu receiving the request gets to run the
requested function. This is usually bad for performance, due to one extra
memory access and 1 extra cacheline usage.
As an example with a 64-bit machine with
CONFIG_BLK_RQ_ALLOC_TIME=y
CONFIG_BLK_WBT=y
CONFIG_BLK_DEV_INTEGRITY=y
CONFIG_BLK_INLINE_ENCRYPTION=y
Will output pahole with:
struct request {
[...]
union {
struct __call_single_data csd; /* 240 32 */
u64 fifo_time; /* 240 8 */
}; /* 240 32 */
[...]
}
At this config, and any cacheline size between 32 and 256, will cause csd
to be split between 2 cachelines: csd->node (16 bytes) in the first
cacheline, and csd->func (8 bytes) & csd->info (8 bytes) in the second.
During blk_mq_complete_send_ipi(), csd->func and csd->info are getting
changed, and when it calls __smp_call_single_queue() csd->node will get
changed.
On the cpu which got the request, csd->func and csd->info get read by
__flush_smp_call_function_queue() and csd->node gets changed by
csd_unlock(), meaning the two cachelines containing csd will get accessed.
To avoid this, it would be necessary to make sure request->csd is placed
somewhere else in the struct, so it is always in a single cacheline,
while avoiding the introduction of any hole in the struct. In order to
achieve this, move request->csd to after 'struct block_device *part'.
The rationale of this change is that:
- There will be no CONFIG_*-dependent field before csd, so there is no
chance of having unexpected holes on given configs.
- On 64-bit machines, csd will be at byte 96, and
- On 32-bit machines, csd will be at byte 64.
This means after this change, request->csd will always be cacheline aligned
for cachelines >= 32-bytes (64-bit) and cachelines >= 16-bytes (32-bits),
as long as struct request is cacheline aligned.
In above change, the struct request size is not supposed to change in any
configuration.
Signed-off-by: Leonardo Bras <leobras@redhat.com>
---
include/linux/blk-mq.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 06caacd77ed6..44201e18681f 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -105,6 +105,11 @@ struct request {
};
struct block_device *part;
+
+ union {
+ struct __call_single_data csd;
+ u64 fifo_time;
+ };
#ifdef CONFIG_BLK_RQ_ALLOC_TIME
/* Time that the first bio started allocating this request. */
u64 alloc_time_ns;
@@ -189,11 +194,6 @@ struct request {
} flush;
};
- union {
- struct __call_single_data csd;
- u64 fifo_time;
- };
-
/*
* completion callback.
*/
--
2.40.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [RFC PATCH v2 2/3] blk-mq: Change request->csd type to call_single_data_t
2023-05-20 5:29 [RFC PATCH v2 0/3] Move usages of struct __call_single_data to call_single_data_t Leonardo Bras
2023-05-20 5:29 ` [RFC PATCH v2 1/3] blk-mq: Move csd inside struct request so it's 32-byte aligned Leonardo Bras
@ 2023-05-20 5:29 ` Leonardo Bras
2023-05-20 5:29 ` [RFC PATCH v2 3/3] smp: Change signatures to use call_single_data_t Leonardo Bras
2023-06-13 3:51 ` [RFC PATCH v2 0/3] Move usages of struct __call_single_data to call_single_data_t Leonardo Bras Soares Passos
3 siblings, 0 replies; 11+ messages in thread
From: Leonardo Bras @ 2023-05-20 5:29 UTC (permalink / raw)
To: Jens Axboe, Peter Zijlstra, Josh Poimboeuf, Palmer Dabbelt,
Leonardo Bras, Guo Ren, Valentin Schneider, Paul E. McKenney,
Juergen Gross, Yury Norov, Marcelo Tosatti
Cc: linux-block, linux-kernel
Currently, request->csd has type struct __call_single_data.
call_single_data_t is defined in include/linux/smp.h :
/* Use __aligned() to avoid to use 2 cache lines for 1 csd */
typedef struct __call_single_data call_single_data_t
__aligned(sizeof(struct __call_single_data));
This is proposed this way so it avoids doing 2 cacheline bounce when
running a csd request.
Changing request->csd to the aligned typedef was previously attempted in
commit 966a967116e6 ("smp: Avoid using two cache lines for struct call_single_data")
but at the time the union that contains csd was positioned near the top of
struct request, only below a struct list_head, and this caused the issue of
holes summing up 24 extra bytes in struct request.
The struct size was restored back to normal by
commit 4ccafe032005 ("block: unalign call_single_data in struct request")
but it caused the csd to be possibly split in 2 cachelines again.
Since request->csd was moved to be always 32-byte aligned inside
'struct request', changing it to the aligned typedef should not cause
any increased size or hole in the struct.
Since this is the last use of the unaligned struct outside smp code, having
this changed will allow us to change smp_call_function_single_async() to
only accept the aligned typedef, and avoid undesired extra cacheline
bounce in future code.
Signed-off-by: Leonardo Bras <leobras@redhat.com>
---
include/linux/blk-mq.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 44201e18681f..6033ef8eb4eb 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -107,7 +107,7 @@ struct request {
struct block_device *part;
union {
- struct __call_single_data csd;
+ call_single_data_t csd;
u64 fifo_time;
};
#ifdef CONFIG_BLK_RQ_ALLOC_TIME
--
2.40.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [RFC PATCH v2 3/3] smp: Change signatures to use call_single_data_t
2023-05-20 5:29 [RFC PATCH v2 0/3] Move usages of struct __call_single_data to call_single_data_t Leonardo Bras
2023-05-20 5:29 ` [RFC PATCH v2 1/3] blk-mq: Move csd inside struct request so it's 32-byte aligned Leonardo Bras
2023-05-20 5:29 ` [RFC PATCH v2 2/3] blk-mq: Change request->csd type to call_single_data_t Leonardo Bras
@ 2023-05-20 5:29 ` Leonardo Bras
2023-06-13 3:51 ` [RFC PATCH v2 0/3] Move usages of struct __call_single_data to call_single_data_t Leonardo Bras Soares Passos
3 siblings, 0 replies; 11+ messages in thread
From: Leonardo Bras @ 2023-05-20 5:29 UTC (permalink / raw)
To: Jens Axboe, Peter Zijlstra, Josh Poimboeuf, Palmer Dabbelt,
Leonardo Bras, Guo Ren, Valentin Schneider, Paul E. McKenney,
Juergen Gross, Yury Norov, Marcelo Tosatti
Cc: linux-block, linux-kernel
Every caller of smp_call_function_single_async() now makes use
of call_single_data_t, which is a size-aligned typedef of
struct __call_single_data.
Changing smp_call_function_single_async() csd parameter to
call_single_data_t makes possible to warn future callers if they
are using an unaligned csd, which can cause it to be split between 2
cachelines, which is usually bad for performance.
Also, for the same reason, change generic_exec_single().
Signed-off-by: Leonardo Bras <leobras@redhat.com>
---
include/linux/smp.h | 2 +-
kernel/smp.c | 4 ++--
kernel/up.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 91ea4a67f8ca..e87520dc2959 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -53,7 +53,7 @@ int smp_call_function_single(int cpuid, smp_call_func_t func, void *info,
void on_each_cpu_cond_mask(smp_cond_func_t cond_func, smp_call_func_t func,
void *info, bool wait, const struct cpumask *mask);
-int smp_call_function_single_async(int cpu, struct __call_single_data *csd);
+int smp_call_function_single_async(int cpu, call_single_data_t *csd);
/*
* Cpus stopping functions in panic. All have default weak definitions.
diff --git a/kernel/smp.c b/kernel/smp.c
index ab3e5dad6cfe..919387be6d4e 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -361,7 +361,7 @@ void __smp_call_single_queue(int cpu, struct llist_node *node)
* for execution on the given CPU. data must already have
* ->func, ->info, and ->flags set.
*/
-static int generic_exec_single(int cpu, struct __call_single_data *csd)
+static int generic_exec_single(int cpu, call_single_data_t *csd)
{
if (cpu == smp_processor_id()) {
smp_call_func_t func = csd->func;
@@ -645,7 +645,7 @@ EXPORT_SYMBOL(smp_call_function_single);
*
* Return: %0 on success or negative errno value on error
*/
-int smp_call_function_single_async(int cpu, struct __call_single_data *csd)
+int smp_call_function_single_async(int cpu, call_single_data_t *csd)
{
int err = 0;
diff --git a/kernel/up.c b/kernel/up.c
index a38b8b095251..df50828cc2f0 100644
--- a/kernel/up.c
+++ b/kernel/up.c
@@ -25,7 +25,7 @@ int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
}
EXPORT_SYMBOL(smp_call_function_single);
-int smp_call_function_single_async(int cpu, struct __call_single_data *csd)
+int smp_call_function_single_async(int cpu, call_single_data_t *csd)
{
unsigned long flags;
--
2.40.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [RFC PATCH v2 0/3] Move usages of struct __call_single_data to call_single_data_t
2023-05-20 5:29 [RFC PATCH v2 0/3] Move usages of struct __call_single_data to call_single_data_t Leonardo Bras
` (2 preceding siblings ...)
2023-05-20 5:29 ` [RFC PATCH v2 3/3] smp: Change signatures to use call_single_data_t Leonardo Bras
@ 2023-06-13 3:51 ` Leonardo Bras Soares Passos
2023-07-04 7:22 ` Leonardo Brás
3 siblings, 1 reply; 11+ messages in thread
From: Leonardo Bras Soares Passos @ 2023-06-13 3:51 UTC (permalink / raw)
To: Jens Axboe, Peter Zijlstra, Josh Poimboeuf, Palmer Dabbelt,
Leonardo Bras, Guo Ren, Valentin Schneider, Paul E. McKenney,
Juergen Gross, Yury Norov, Marcelo Tosatti
Cc: linux-block, linux-kernel
Friendly ping
On Sat, May 20, 2023 at 2:30 AM Leonardo Bras <leobras@redhat.com> wrote:
>
> Changes since RFCv1:
> - request->csd moved to the middle of the struct, without size impact
> - type change happens in a different patch (thanks Jens Axboe!)
> - Improved the third patch to also update the .h file.
>
> Leonardo Bras (3):
> blk-mq: Move csd inside struct request so it's 32-byte aligned
> blk-mq: Change request->csd type to call_single_data_t
> smp: Change signatures to use call_single_data_t
>
> include/linux/blk-mq.h | 10 +++++-----
> include/linux/smp.h | 2 +-
> kernel/smp.c | 4 ++--
> kernel/up.c | 2 +-
> 4 files changed, 9 insertions(+), 9 deletions(-)
>
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [RFC PATCH v2 0/3] Move usages of struct __call_single_data to call_single_data_t
2023-06-13 3:51 ` [RFC PATCH v2 0/3] Move usages of struct __call_single_data to call_single_data_t Leonardo Bras Soares Passos
@ 2023-07-04 7:22 ` Leonardo Brás
2023-08-29 0:55 ` Leonardo Brás
0 siblings, 1 reply; 11+ messages in thread
From: Leonardo Brás @ 2023-07-04 7:22 UTC (permalink / raw)
To: Jens Axboe, Peter Zijlstra, Josh Poimboeuf, Palmer Dabbelt,
Guo Ren, Valentin Schneider, Paul E. McKenney, Juergen Gross,
Yury Norov, Marcelo Tosatti
Cc: linux-block, linux-kernel
On Tue, 2023-06-13 at 00:51 -0300, Leonardo Bras Soares Passos wrote:
> Friendly ping
>
> On Sat, May 20, 2023 at 2:30 AM Leonardo Bras <leobras@redhat.com> wrote:
> >
> > Changes since RFCv1:
> > - request->csd moved to the middle of the struct, without size impact
> > - type change happens in a different patch (thanks Jens Axboe!)
> > - Improved the third patch to also update the .h file.
> >
> > Leonardo Bras (3):
> > blk-mq: Move csd inside struct request so it's 32-byte aligned
> > blk-mq: Change request->csd type to call_single_data_t
> > smp: Change signatures to use call_single_data_t
> >
> > include/linux/blk-mq.h | 10 +++++-----
> > include/linux/smp.h | 2 +-
> > kernel/smp.c | 4 ++--
> > kernel/up.c | 2 +-
> > 4 files changed, 9 insertions(+), 9 deletions(-)
> >
> > --
> > 2.40.1
> >
Hello Jens,
I still want your feedback on this series :)
I think I addressed every issue of RFCv1, but if you have any other feedback,
please let me know.
Thanks!
Leo
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [RFC PATCH v2 0/3] Move usages of struct __call_single_data to call_single_data_t
2023-07-04 7:22 ` Leonardo Brás
@ 2023-08-29 0:55 ` Leonardo Brás
2023-08-29 2:29 ` Chengming Zhou
0 siblings, 1 reply; 11+ messages in thread
From: Leonardo Brás @ 2023-08-29 0:55 UTC (permalink / raw)
To: Jens Axboe, Peter Zijlstra, Josh Poimboeuf, Palmer Dabbelt,
Guo Ren, Valentin Schneider, Paul E. McKenney, Juergen Gross,
Yury Norov, Marcelo Tosatti
Cc: linux-block, linux-kernel
On Tue, 2023-07-04 at 04:22 -0300, Leonardo Brás wrote:
> On Tue, 2023-06-13 at 00:51 -0300, Leonardo Bras Soares Passos wrote:
> > Friendly ping
> >
> > On Sat, May 20, 2023 at 2:30 AM Leonardo Bras <leobras@redhat.com> wrote:
> > >
> > > Changes since RFCv1:
> > > - request->csd moved to the middle of the struct, without size impact
> > > - type change happens in a different patch (thanks Jens Axboe!)
> > > - Improved the third patch to also update the .h file.
> > >
> > > Leonardo Bras (3):
> > > blk-mq: Move csd inside struct request so it's 32-byte aligned
> > > blk-mq: Change request->csd type to call_single_data_t
> > > smp: Change signatures to use call_single_data_t
> > >
> > > include/linux/blk-mq.h | 10 +++++-----
> > > include/linux/smp.h | 2 +-
> > > kernel/smp.c | 4 ++--
> > > kernel/up.c | 2 +-
> > > 4 files changed, 9 insertions(+), 9 deletions(-)
> > >
> > > --
> > > 2.40.1
> > >
>
> Hello Jens,
>
> I still want your feedback on this series :)
>
> I think I addressed every issue of RFCv1, but if you have any other feedback,
> please let me know.
>
> Thanks!
> Leo
Hello Jens Axboe,
Please provide feedback on this series!
Are you ok with those changes?
What's your opinion on them?
Thanks!
Leo
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [RFC PATCH v2 0/3] Move usages of struct __call_single_data to call_single_data_t
2023-08-29 0:55 ` Leonardo Brás
@ 2023-08-29 2:29 ` Chengming Zhou
2023-08-30 22:29 ` Leonardo Brás
0 siblings, 1 reply; 11+ messages in thread
From: Chengming Zhou @ 2023-08-29 2:29 UTC (permalink / raw)
To: Leonardo Brás, Jens Axboe, Peter Zijlstra, Josh Poimboeuf,
Palmer Dabbelt, Guo Ren, Valentin Schneider, Paul E. McKenney,
Juergen Gross, Yury Norov, Marcelo Tosatti
Cc: linux-block, linux-kernel
On 2023/8/29 08:55, Leonardo Brás wrote:
> On Tue, 2023-07-04 at 04:22 -0300, Leonardo Brás wrote:
>> On Tue, 2023-06-13 at 00:51 -0300, Leonardo Bras Soares Passos wrote:
>>> Friendly ping
>>>
>>> On Sat, May 20, 2023 at 2:30 AM Leonardo Bras <leobras@redhat.com> wrote:
>>>>
>>>> Changes since RFCv1:
>>>> - request->csd moved to the middle of the struct, without size impact
>>>> - type change happens in a different patch (thanks Jens Axboe!)
>>>> - Improved the third patch to also update the .h file.
>>>>
>>>> Leonardo Bras (3):
>>>> blk-mq: Move csd inside struct request so it's 32-byte aligned
>>>> blk-mq: Change request->csd type to call_single_data_t
>>>> smp: Change signatures to use call_single_data_t
>>>>
>>>> include/linux/blk-mq.h | 10 +++++-----
>>>> include/linux/smp.h | 2 +-
>>>> kernel/smp.c | 4 ++--
>>>> kernel/up.c | 2 +-
>>>> 4 files changed, 9 insertions(+), 9 deletions(-)
>>>>
>>>> --
>>>> 2.40.1
>>>>
>>
>> Hello Jens,
>>
>> I still want your feedback on this series :)
>>
>> I think I addressed every issue of RFCv1, but if you have any other feedback,
>> please let me know.
>>
>> Thanks!
>> Leo
>
> Hello Jens Axboe,
>
> Please provide feedback on this series!
>
> Are you ok with those changes?
> What's your opinion on them?
>
> Thanks!
> Leo
>
Hello,
FYI, there is no csd in struct request anymore in block/for-next branch,
which is deleted by this commit:
commit 660e802c76c89e871c29cd3174c07c8d23e39c35
Author: Chengming Zhou <zhouchengming@bytedance.com>
Date: Mon Jul 17 12:00:55 2023 +0800
blk-mq: use percpu csd to remote complete instead of per-rq csd
If request need to be completed remotely, we insert it into percpu llist,
and smp_call_function_single_async() if llist is empty previously.
We don't need to use per-rq csd, percpu csd is enough. And the size of
struct request is decreased by 24 bytes.
This way is cleaner, and looks correct, given block softirq is guaranteed
to be scheduled to consume the list if one new request is added to this
percpu list, either smp_call_function_single_async() returns -EBUSY or 0.
Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20230717040058.3993930-2-chengming.zhou@linux.dev
Signed-off-by: Jens Axboe <axboe@kernel.dk>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [RFC PATCH v2 0/3] Move usages of struct __call_single_data to call_single_data_t
2023-08-29 2:29 ` Chengming Zhou
@ 2023-08-30 22:29 ` Leonardo Brás
2023-08-30 22:48 ` Jens Axboe
0 siblings, 1 reply; 11+ messages in thread
From: Leonardo Brás @ 2023-08-30 22:29 UTC (permalink / raw)
To: Chengming Zhou, Jens Axboe, Peter Zijlstra, Josh Poimboeuf,
Palmer Dabbelt, Guo Ren, Valentin Schneider, Paul E. McKenney,
Juergen Gross, Yury Norov, Marcelo Tosatti
Cc: linux-block, linux-kernel
On Tue, 2023-08-29 at 10:29 +0800, Chengming Zhou wrote:
> On 2023/8/29 08:55, Leonardo Brás wrote:
> > On Tue, 2023-07-04 at 04:22 -0300, Leonardo Brás wrote:
> > > On Tue, 2023-06-13 at 00:51 -0300, Leonardo Bras Soares Passos wrote:
> > > > Friendly ping
> > > >
> > > > On Sat, May 20, 2023 at 2:30 AM Leonardo Bras <leobras@redhat.com> wrote:
> > > > >
> > > > > Changes since RFCv1:
> > > > > - request->csd moved to the middle of the struct, without size impact
> > > > > - type change happens in a different patch (thanks Jens Axboe!)
> > > > > - Improved the third patch to also update the .h file.
> > > > >
> > > > > Leonardo Bras (3):
> > > > > blk-mq: Move csd inside struct request so it's 32-byte aligned
> > > > > blk-mq: Change request->csd type to call_single_data_t
> > > > > smp: Change signatures to use call_single_data_t
> > > > >
> > > > > include/linux/blk-mq.h | 10 +++++-----
> > > > > include/linux/smp.h | 2 +-
> > > > > kernel/smp.c | 4 ++--
> > > > > kernel/up.c | 2 +-
> > > > > 4 files changed, 9 insertions(+), 9 deletions(-)
> > > > >
> > > > > --
> > > > > 2.40.1
> > > > >
> > >
> > > Hello Jens,
> > >
> > > I still want your feedback on this series :)
> > >
> > > I think I addressed every issue of RFCv1, but if you have any other feedback,
> > > please let me know.
> > >
> > > Thanks!
> > > Leo
> >
> > Hello Jens Axboe,
> >
> > Please provide feedback on this series!
> >
> > Are you ok with those changes?
> > What's your opinion on them?
> >
> > Thanks!
> > Leo
> >
>
> Hello,
>
> FYI, there is no csd in struct request anymore in block/for-next branch,
> which is deleted by this commit:
>
> commit 660e802c76c89e871c29cd3174c07c8d23e39c35
> Author: Chengming Zhou <zhouchengming@bytedance.com>
> Date: Mon Jul 17 12:00:55 2023 +0800
>
> blk-mq: use percpu csd to remote complete instead of per-rq csd
>
> If request need to be completed remotely, we insert it into percpu llist,
> and smp_call_function_single_async() if llist is empty previously.
>
> We don't need to use per-rq csd, percpu csd is enough. And the size of
> struct request is decreased by 24 bytes.
>
> This way is cleaner, and looks correct, given block softirq is guaranteed
> to be scheduled to consume the list if one new request is added to this
> percpu list, either smp_call_function_single_async() returns -EBUSY or 0.
>
> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
> Reviewed-by: Ming Lei <ming.lei@redhat.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Link: https://lore.kernel.org/r/20230717040058.3993930-2-chengming.zhou@linux.dev
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
>
Oh, thanks for the heads-up!
I will send reviewed version of patch 3.
I suppose it can go on top of block/for-next, since the above patch is there.
Does that work for you Jens Axboe?
Thanks!
Leo
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [RFC PATCH v2 0/3] Move usages of struct __call_single_data to call_single_data_t
2023-08-30 22:29 ` Leonardo Brás
@ 2023-08-30 22:48 ` Jens Axboe
2023-08-31 2:04 ` Leonardo Brás
0 siblings, 1 reply; 11+ messages in thread
From: Jens Axboe @ 2023-08-30 22:48 UTC (permalink / raw)
To: Leonardo Brás, Chengming Zhou, Peter Zijlstra,
Josh Poimboeuf, Palmer Dabbelt, Guo Ren, Valentin Schneider,
Paul E. McKenney, Juergen Gross, Yury Norov, Marcelo Tosatti
Cc: linux-block, linux-kernel
On 8/30/23 4:29 PM, Leonardo Br?s wrote:
> On Tue, 2023-08-29 at 10:29 +0800, Chengming Zhou wrote:
>> On 2023/8/29 08:55, Leonardo Br?s wrote:
>>> On Tue, 2023-07-04 at 04:22 -0300, Leonardo Br?s wrote:
>>>> On Tue, 2023-06-13 at 00:51 -0300, Leonardo Bras Soares Passos wrote:
>>>>> Friendly ping
>>>>>
>>>>> On Sat, May 20, 2023 at 2:30?AM Leonardo Bras <leobras@redhat.com> wrote:
>>>>>>
>>>>>> Changes since RFCv1:
>>>>>> - request->csd moved to the middle of the struct, without size impact
>>>>>> - type change happens in a different patch (thanks Jens Axboe!)
>>>>>> - Improved the third patch to also update the .h file.
>>>>>>
>>>>>> Leonardo Bras (3):
>>>>>> blk-mq: Move csd inside struct request so it's 32-byte aligned
>>>>>> blk-mq: Change request->csd type to call_single_data_t
>>>>>> smp: Change signatures to use call_single_data_t
>>>>>>
>>>>>> include/linux/blk-mq.h | 10 +++++-----
>>>>>> include/linux/smp.h | 2 +-
>>>>>> kernel/smp.c | 4 ++--
>>>>>> kernel/up.c | 2 +-
>>>>>> 4 files changed, 9 insertions(+), 9 deletions(-)
>>>>>>
>>>>>> --
>>>>>> 2.40.1
>>>>>>
>>>>
>>>> Hello Jens,
>>>>
>>>> I still want your feedback on this series :)
>>>>
>>>> I think I addressed every issue of RFCv1, but if you have any other feedback,
>>>> please let me know.
>>>>
>>>> Thanks!
>>>> Leo
>>>
>>> Hello Jens Axboe,
>>>
>>> Please provide feedback on this series!
>>>
>>> Are you ok with those changes?
>>> What's your opinion on them?
>>>
>>> Thanks!
>>> Leo
>>>
>>
>> Hello,
>>
>> FYI, there is no csd in struct request anymore in block/for-next branch,
>> which is deleted by this commit:
>>
>> commit 660e802c76c89e871c29cd3174c07c8d23e39c35
>> Author: Chengming Zhou <zhouchengming@bytedance.com>
>> Date: Mon Jul 17 12:00:55 2023 +0800
>>
>> blk-mq: use percpu csd to remote complete instead of per-rq csd
>>
>> If request need to be completed remotely, we insert it into percpu llist,
>> and smp_call_function_single_async() if llist is empty previously.
>>
>> We don't need to use per-rq csd, percpu csd is enough. And the size of
>> struct request is decreased by 24 bytes.
>>
>> This way is cleaner, and looks correct, given block softirq is guaranteed
>> to be scheduled to consume the list if one new request is added to this
>> percpu list, either smp_call_function_single_async() returns -EBUSY or 0.
>>
>> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
>> Reviewed-by: Ming Lei <ming.lei@redhat.com>
>> Reviewed-by: Christoph Hellwig <hch@lst.de>
>> Link: https://lore.kernel.org/r/20230717040058.3993930-2-chengming.zhou@linux.dev
>> Signed-off-by: Jens Axboe <axboe@kernel.dk>
>>
>
>
> Oh, thanks for the heads-up!
> I will send reviewed version of patch 3.
>
> I suppose it can go on top of block/for-next, since the above patch is there.
> Does that work for you Jens Axboe?
Just send it against Linus's tree, it's all upstream now.
--
Jens Axboe
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [RFC PATCH v2 0/3] Move usages of struct __call_single_data to call_single_data_t
2023-08-30 22:48 ` Jens Axboe
@ 2023-08-31 2:04 ` Leonardo Brás
0 siblings, 0 replies; 11+ messages in thread
From: Leonardo Brás @ 2023-08-31 2:04 UTC (permalink / raw)
To: Jens Axboe, Chengming Zhou, Peter Zijlstra, Josh Poimboeuf,
Palmer Dabbelt, Guo Ren, Valentin Schneider, Paul E. McKenney,
Juergen Gross, Yury Norov, Marcelo Tosatti
Cc: linux-block, linux-kernel
On Wed, 2023-08-30 at 16:48 -0600, Jens Axboe wrote:
> On 8/30/23 4:29 PM, Leonardo Br?s wrote:
> > On Tue, 2023-08-29 at 10:29 +0800, Chengming Zhou wrote:
> > > On 2023/8/29 08:55, Leonardo Br?s wrote:
> > > > On Tue, 2023-07-04 at 04:22 -0300, Leonardo Br?s wrote:
> > > > > On Tue, 2023-06-13 at 00:51 -0300, Leonardo Bras Soares Passos wrote:
> > > > > > Friendly ping
> > > > > >
> > > > > > On Sat, May 20, 2023 at 2:30?AM Leonardo Bras <leobras@redhat.com> wrote:
> > > > > > >
> > > > > > > Changes since RFCv1:
> > > > > > > - request->csd moved to the middle of the struct, without size impact
> > > > > > > - type change happens in a different patch (thanks Jens Axboe!)
> > > > > > > - Improved the third patch to also update the .h file.
> > > > > > >
> > > > > > > Leonardo Bras (3):
> > > > > > > blk-mq: Move csd inside struct request so it's 32-byte aligned
> > > > > > > blk-mq: Change request->csd type to call_single_data_t
> > > > > > > smp: Change signatures to use call_single_data_t
> > > > > > >
> > > > > > > include/linux/blk-mq.h | 10 +++++-----
> > > > > > > include/linux/smp.h | 2 +-
> > > > > > > kernel/smp.c | 4 ++--
> > > > > > > kernel/up.c | 2 +-
> > > > > > > 4 files changed, 9 insertions(+), 9 deletions(-)
> > > > > > >
> > > > > > > --
> > > > > > > 2.40.1
> > > > > > >
> > > > >
> > > > > Hello Jens,
> > > > >
> > > > > I still want your feedback on this series :)
> > > > >
> > > > > I think I addressed every issue of RFCv1, but if you have any other feedback,
> > > > > please let me know.
> > > > >
> > > > > Thanks!
> > > > > Leo
> > > >
> > > > Hello Jens Axboe,
> > > >
> > > > Please provide feedback on this series!
> > > >
> > > > Are you ok with those changes?
> > > > What's your opinion on them?
> > > >
> > > > Thanks!
> > > > Leo
> > > >
> > >
> > > Hello,
> > >
> > > FYI, there is no csd in struct request anymore in block/for-next branch,
> > > which is deleted by this commit:
> > >
> > > commit 660e802c76c89e871c29cd3174c07c8d23e39c35
> > > Author: Chengming Zhou <zhouchengming@bytedance.com>
> > > Date: Mon Jul 17 12:00:55 2023 +0800
> > >
> > > blk-mq: use percpu csd to remote complete instead of per-rq csd
> > >
> > > If request need to be completed remotely, we insert it into percpu llist,
> > > and smp_call_function_single_async() if llist is empty previously.
> > >
> > > We don't need to use per-rq csd, percpu csd is enough. And the size of
> > > struct request is decreased by 24 bytes.
> > >
> > > This way is cleaner, and looks correct, given block softirq is guaranteed
> > > to be scheduled to consume the list if one new request is added to this
> > > percpu list, either smp_call_function_single_async() returns -EBUSY or 0.
> > >
> > > Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
> > > Reviewed-by: Ming Lei <ming.lei@redhat.com>
> > > Reviewed-by: Christoph Hellwig <hch@lst.de>
> > > Link: https://lore.kernel.org/r/20230717040058.3993930-2-chengming.zhou@linux.dev
> > > Signed-off-by: Jens Axboe <axboe@kernel.dk>
> > >
> >
> >
> > Oh, thanks for the heads-up!
> > I will send reviewed version of patch 3.
> >
> > I suppose it can go on top of block/for-next, since the above patch is there.
> > Does that work for you Jens Axboe?
>
> Just send it against Linus's tree, it's all upstream now.
>
Sure,
Thanks!
Leo
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2023-08-31 2:11 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-20 5:29 [RFC PATCH v2 0/3] Move usages of struct __call_single_data to call_single_data_t Leonardo Bras
2023-05-20 5:29 ` [RFC PATCH v2 1/3] blk-mq: Move csd inside struct request so it's 32-byte aligned Leonardo Bras
2023-05-20 5:29 ` [RFC PATCH v2 2/3] blk-mq: Change request->csd type to call_single_data_t Leonardo Bras
2023-05-20 5:29 ` [RFC PATCH v2 3/3] smp: Change signatures to use call_single_data_t Leonardo Bras
2023-06-13 3:51 ` [RFC PATCH v2 0/3] Move usages of struct __call_single_data to call_single_data_t Leonardo Bras Soares Passos
2023-07-04 7:22 ` Leonardo Brás
2023-08-29 0:55 ` Leonardo Brás
2023-08-29 2:29 ` Chengming Zhou
2023-08-30 22:29 ` Leonardo Brás
2023-08-30 22:48 ` Jens Axboe
2023-08-31 2:04 ` Leonardo Brás
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).