linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leonardo Bras <leobras@redhat.com>
To: Jens Axboe <axboe@kernel.dk>,
	Peter Zijlstra <peterz@infradead.org>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	Palmer Dabbelt <palmer@rivosinc.com>,
	Leonardo Bras <leobras@redhat.com>, Guo Ren <guoren@kernel.org>,
	Valentin Schneider <vschneid@redhat.com>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Juergen Gross <jgross@suse.com>,
	Yury Norov <yury.norov@gmail.com>,
	Marcelo Tosatti <mtosatti@redhat.com>
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [RFC PATCH v2 2/3] blk-mq: Change request->csd type to call_single_data_t
Date: Sat, 20 May 2023 02:29:57 -0300	[thread overview]
Message-ID: <20230520052957.798486-3-leobras@redhat.com> (raw)
In-Reply-To: <20230520052957.798486-1-leobras@redhat.com>

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


  parent reply	other threads:[~2023-05-20  5:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=20230520052957.798486-3-leobras@redhat.com \
    --to=leobras@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=guoren@kernel.org \
    --cc=jgross@suse.com \
    --cc=jpoimboe@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=palmer@rivosinc.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=vschneid@redhat.com \
    --cc=yury.norov@gmail.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).