Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp887766pxj; Fri, 21 May 2021 01:14:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAQUpsiXDATM6CYz78ELJXJ4ccS7vAwrX5Cu7f1xBl9co8j0ViGyQ7VqKsVDghV5490d8L X-Received: by 2002:a17:907:2bf4:: with SMTP id gv52mr9020529ejc.271.1621584858934; Fri, 21 May 2021 01:14:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1621584858; cv=pass; d=google.com; s=arc-20160816; b=0ICT2riaEwzIwwEuaRwXdXi9/VRG6AzDTlXy2sS8nRHH5mz6ZeKfg5CaHeRyIKKtVO SmPLyH25jxRMiRSgMinLpAk0W4mkMJmvDv+Ous4YhOvA2NJTNuFTS+1DXrfHlnq+JOaT ulwffLgmKBmr5ipLjj5lown/8IOBgFSh4xDpVOQMbHFwLMnCFfTYyjj6C0T4C6jWlCX5 VVcbg6X3zeAdbMyD7BNL/6GRL6TfOQsGZ2Unfqr9VXC2ErMPyZuZwQ477nYU7dezQQM3 VCdVVJ66qLo1YB/wEtpj9JkYsrZ0+c5ebt5KYgTblQgVXHpiPyNoTXAe+lMjMBIyjAch k3Og== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=z6PcDwod4PDMdlhheGDlJbYaeMwSliXVnfyWPPyVrU0=; b=NVRClOv0aOPavMGYRHtC8s+AlxB8EIsI9gBqj13yk1FWoW2ADo6UPVecAPcAOO4N9M LbYsM6kPeeY+M3L6MwIUGWHgr0PfcMd+7kSHGXUZzRky58F264LoVGRxVHNr1C6SwKKa sRYc1LJBemxmNvolVmmvK2cRuw8W0+ufr4GAnphuwgIAHSMfg7VAxKmA91L5Oej6DSIo BMOZc21Ntyawg4rMNIMuhP1ErD9obkY9cYsgcUGndwNe0d0uv5XpRoNyMNwoQgsHjo0J 43NbaEEoCArxHEY1nXalXORMJN8ECVNWMqwQ5vl2YaYw6xjDWPeamtajHggsauA7AbI1 7Drw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=adPeNp42; arc=pass (i=1 spf=pass spfdomain=fb.com dkim=pass dkdomain=fb.com dmarc=pass fromdomain=fb.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j16si6281676edj.401.2021.05.21.01.13.55; Fri, 21 May 2021 01:14:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=adPeNp42; arc=pass (i=1 spf=pass spfdomain=fb.com dkim=pass dkdomain=fb.com dmarc=pass fromdomain=fb.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230420AbhETVsh (ORCPT + 99 others); Thu, 20 May 2021 17:48:37 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:25362 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230343AbhETVsf (ORCPT ); Thu, 20 May 2021 17:48:35 -0400 Received: from pps.filterd (m0148461.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 14KLY0uL006346; Thu, 20 May 2021 14:46:52 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-id : content-transfer-encoding : mime-version; s=facebook; bh=z6PcDwod4PDMdlhheGDlJbYaeMwSliXVnfyWPPyVrU0=; b=adPeNp42IBppOI6hR3ONIT3BuiSyUOqZRi7DXrWBhv6LPmedJO/25vlNX8/9Erv5yNBo YktBUM30M4sxLWVKmJz8T4+ZkZ+zD7FIJHVUg3odrm6Ukr6UIfzKifkBUGR/DWTC+Mkh nHuuQfAVQByhv6MUOL6YwK6G7oKu6Fj99uI= Received: from mail.thefacebook.com ([163.114.132.120]) by mx0a-00082601.pphosted.com with ESMTP id 38n6p30ub5-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Thu, 20 May 2021 14:46:52 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (100.104.98.9) by o365-in.thefacebook.com (100.104.94.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 20 May 2021 14:46:51 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=od/Sk7mxPepH91sjJi03Y7bR17HTMG48akdXlzt7c0HbFaMwy1HM2HR7B0F5AHJY+O5R558dG4q3rteodG7iA0WYs21uu70I6UqKzWnGmUtGe4/LWNgq2zlTHVCGw9f0xjM53c9CLd+gWkzi07GwSiCgdK/zfblEI8KMHzrp6Xhco7rY+qI0MKcIBy4Ep8vUozBj5Ygbp+91OfXuA+Dwa8I/EIMJiWSFuMUchXvqqxsmS3spsLBERGY/ZVDrB+tb1vpXi7ejsvZvHROZvGQe6gb8I3qnE9wx1wkisK0Nk1q7Uof6P5j1ZwFpSj9SVE5eaiFm46O+ABWmPfo+eV0TyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z6PcDwod4PDMdlhheGDlJbYaeMwSliXVnfyWPPyVrU0=; b=h+H2rVqL2Zvvw+ZqvETxVD1tT/XEQ8uIlG4ZSJ4d27Kz9xpkV0iy24AbH81RnAK6n1lAYQ/I4eMVj01RPvJGJCd/CWNzwirGdvSW2ILOXRegPglzG/k1r5n0VsBldX7U+CGKOAQNEh7a975GDGwC2o9yQK77NboM5Zmli/PuTdRHjBxuPf7Bw4+1E662XqACdzo5JU7VsfxmZNZTac2PCFI9z3/TSU1ysZPX9tfCDrFtf2V9SY02JyF3DD2L+wSAETj3PKFQenZf7HsP3TCVnp/9PzK7OQzyrz2M3whJOqbSQGrViZhJJEnj6E2vK4YCjZQXsageeG7ixncgwWtwCA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=fb.com; dmarc=pass action=none header.from=fb.com; dkim=pass header.d=fb.com; arc=none Received: from BYAPR15MB2999.namprd15.prod.outlook.com (2603:10b6:a03:fa::12) by BYAPR15MB3256.namprd15.prod.outlook.com (2603:10b6:a03:10f::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.26; Thu, 20 May 2021 21:46:47 +0000 Received: from BYAPR15MB2999.namprd15.prod.outlook.com ([fe80::38d3:cc71:bca8:dd2a]) by BYAPR15MB2999.namprd15.prod.outlook.com ([fe80::38d3:cc71:bca8:dd2a%5]) with mapi id 15.20.4129.033; Thu, 20 May 2021 21:46:47 +0000 From: Song Liu To: Pavel Begunkov CC: "io-uring@vger.kernel.org" , Networking , "bpf@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Jens Axboe , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin Lau , Yonghong Song , John Fastabend , KP Singh , Horst Schirmeier , "Franz-B . Tuneke" , Christian Dietrich Subject: Re: [PATCH 01/23] io_uring: shuffle rarely used ctx fields Thread-Topic: [PATCH 01/23] io_uring: shuffle rarely used ctx fields Thread-Index: AQHXTLk17dWezJtB9kirPhycVh7qbKrs6dAA Date: Thu, 20 May 2021 21:46:47 +0000 Message-ID: <0339DB35-27AC-4A50-B807-968C72ABB698@fb.com> References: <485abb65cf032f4ddf13dcc0bd60e5475638efc2.1621424513.git.asml.silence@gmail.com> In-Reply-To: <485abb65cf032f4ddf13dcc0bd60e5475638efc2.1621424513.git.asml.silence@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: Apple Mail (2.3654.80.0.2.43) authentication-results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=fb.com; x-originating-ip: [2620:10d:c090:400::5:fa93] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ff54c24f-fba8-4010-018b-08d91bd8c4ae x-ms-traffictypediagnostic: BYAPR15MB3256: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-fb-source: Internal x-ms-oob-tlc-oobclassifiers: OLM:449; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: qMTNp2qDnLAwy6LnyjbHTqSjhfFGj5jca17fYWf7GxuF9FHZnr3x+XgwDy3yJJKXw49Rsrfdm2VJEOQpgDjjKI4lUZTcHi+2L8H/VFJNqc3WxqrOpRrbEfdpG/tptjWNflXAHMidTq6rral3IPrYKVBkAnMywLi/t4a4I1rx5IDRkKvuINeG7kirWtWPLq0YVyapTCH2ID56h1PUm49YOrwYqJpwXttgFpIQaHpNnzBbOCOkz1W6FnZUnzo7hsGHS3whWWQXXcC3ZTCKsYgmWT8V/4t6zyUjkcCFzrldxQzFnju0CupM9+63ti1WO9BqTKHEu/00S5e5E5MiugdbE051w+ecc8xjwHlwwg+/CoObxDAgtviFW//kLOygVlXRZh8XBVJFOIbu2IkItIvNgMvOFjTuO7q/PHEyYm9N9jhcZAEqJnCMGPf5YHicenSI0MxQyYLH/pWkaDeb1/KyLS87pAk4TtJjCcz0okxkOSa7MtVg6cZZO73CkF4nAhSJBMidusVLIr8n6Eq0taQbAesIWlUms4XbsHniObx9FuXlYnhnxUJ1hJtLlCue9ctIdIw8SoF9/3p3q82tAGwMFZS54lT438bRWpgwynRoVhuNz8rDtspsJnbY0SblBqGQ8zDHTD5ts8TERH2w19ix/zM/rw0c06cuqgufrMLuwPc= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR15MB2999.namprd15.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(136003)(396003)(39860400002)(376002)(346002)(366004)(66556008)(64756008)(66476007)(66446008)(66946007)(478600001)(186003)(91956017)(4326008)(316002)(6486002)(5660300002)(6506007)(53546011)(76116006)(6512007)(6916009)(54906003)(2906002)(38100700002)(122000001)(33656002)(83380400001)(36756003)(86362001)(7416002)(8936002)(8676002)(71200400001)(2616005)(45980500001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?UUBot7YMNVFYGsw3/POxiyR9z6GIoScv3Wz8FuHafXTc1UNar0fYgXOS0lIm?= =?us-ascii?Q?ybX/o4rXWoiJz73CCnoh/yoqO+eLYeXtNahnA2PIUUF3cNBkBHqZcQ+vMNQt?= =?us-ascii?Q?Tu7MRlUG2c9A+C2DMOE0FcOX5hUOYpkpZNccVgWcohaT7eZv+9Tojteo2hqB?= =?us-ascii?Q?MCQ+rfGR/HykCx/ooXxkOSxq+1fN6dICDL/nrNEwNbd1k4blZTGCqq2a5lpX?= =?us-ascii?Q?wKc41ly9vYKa3KKmSfvrxN/EPz8/KlvIb+N9jTIAiOGKcLqMg3p0O8Bao3/h?= =?us-ascii?Q?1TIwrGqrTmazzAgii7og7UKGd5ToX6KRVqS6DhWjAW012vpmUuZ4E0BQZwjB?= =?us-ascii?Q?T4aIOwyU0zFvRpiUuY2Whg5MGPQd0vqmPBS/PmcDptv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FVVvdp1Q/L/47enFRA9n2muJ5X5MYPlLMobUkIxTJ?= =?us-ascii?Q?kuZemWuJ8X4CUuTRN9xxOGfTelZPKugRJd+U27Qs34suPCYRZsYQ6cHw73+y?= =?us-ascii?Q?cBrBE/0=3D?= Content-Type: text/plain; charset="us-ascii" Content-ID: <25B8C0346FCD994E878FBEE605F3887C@namprd15.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR15MB2999.namprd15.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ff54c24f-fba8-4010-018b-08d91bd8c4ae X-MS-Exchange-CrossTenant-originalarrivaltime: 20 May 2021 21:46:47.4480 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: N19MRrij0jZlLjTltfObV+N1kMIoxVI8zymyqQuuzwvbb4ZyEKcOIJ5xmt8h6fuArzgz6Eag1lcLsf+uCYO5ig== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR15MB3256 X-OriginatorOrg: fb.com X-Proofpoint-ORIG-GUID: IV8N-7d_jP2-O8BIySZAfN3M2q_xDKRm X-Proofpoint-GUID: IV8N-7d_jP2-O8BIySZAfN3M2q_xDKRm X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-05-20_06:2021-05-20,2021-05-20 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 spamscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 clxscore=1011 mlxscore=0 mlxlogscore=999 priorityscore=1501 impostorscore=0 suspectscore=0 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105200136 X-FB-Internal: deliver Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On May 19, 2021, at 7:13 AM, Pavel Begunkov wrot= e: >=20 > There is a bunch of scattered around ctx fields that are almost never > used, e.g. only on ring exit, plunge them to the end, better locality, > better aesthetically. >=20 > Signed-off-by: Pavel Begunkov > --- > fs/io_uring.c | 36 +++++++++++++++++------------------- > 1 file changed, 17 insertions(+), 19 deletions(-) >=20 > diff --git a/fs/io_uring.c b/fs/io_uring.c > index 9ac5e278a91e..7e3410ce100a 100644 > --- a/fs/io_uring.c > +++ b/fs/io_uring.c > @@ -367,9 +367,6 @@ struct io_ring_ctx { > unsigned cached_cq_overflow; > unsigned long sq_check_overflow; >=20 > - /* hashed buffered write serialization */ > - struct io_wq_hash *hash_map; > - > struct list_head defer_list; > struct list_head timeout_list; > struct list_head cq_overflow_list; > @@ -386,9 +383,6 @@ struct io_ring_ctx { >=20 > struct io_rings *rings; >=20 > - /* Only used for accounting purposes */ > - struct mm_struct *mm_account; > - > const struct cred *sq_creds; /* cred used for __io_sq_thread() */ > struct io_sq_data *sq_data; /* if using sq thread polling */ >=20 > @@ -409,14 +403,6 @@ struct io_ring_ctx { > unsigned nr_user_bufs; > struct io_mapped_ubuf **user_bufs; >=20 > - struct user_struct *user; > - > - struct completion ref_comp; > - > -#if defined(CONFIG_UNIX) > - struct socket *ring_sock; > -#endif > - > struct xarray io_buffers; >=20 > struct xarray personalities; > @@ -460,12 +446,24 @@ struct io_ring_ctx { >=20 > struct io_restriction restrictions; >=20 > - /* exit task_work */ > - struct callback_head *exit_task_work; > - > /* Keep this last, we don't need it for the fast path */ > - struct work_struct exit_work; > - struct list_head tctx_list; > + struct { Why do we need an anonymous struct here? For cache line alignment? Do we need ____cacheline_aligned_in_smp? > + #if defined(CONFIG_UNIX) > + struct socket *ring_sock; > + #endif > + /* hashed buffered write serialization */ > + struct io_wq_hash *hash_map; > + > + /* Only used for accounting purposes */ > + struct user_struct *user; > + struct mm_struct *mm_account; > + > + /* ctx exit and cancelation */ > + struct callback_head *exit_task_work; > + struct work_struct exit_work; > + struct list_head tctx_list; > + struct completion ref_comp; > + }; > }; >=20 > struct io_uring_task { > --=20 > 2.31.1 >=20