Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp1622234lkv; Wed, 19 May 2021 14:16:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjy4CWLB3rfIvqoJwzghvPjFyyLcjWB76Af7wy710jDm2gbUQ69YKVXeVPHqdegSc3XJHU X-Received: by 2002:a05:6e02:1c4c:: with SMTP id d12mr1280027ilg.161.1621459006807; Wed, 19 May 2021 14:16:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621459006; cv=none; d=google.com; s=arc-20160816; b=Qb25DqZHcESGDnwX5ZqEyG1AbO8FuS1RgcZQJKaxP79L4JaFL92ggAhDpwJ+UZ1DN1 NldRTJCdSL8x2n+si+9OIY1dhIHU0o1UN5gNOG1G8WfeO2gN39jwMJFdN6uYkfobBC3M dMe+hcxlV/7TQhH0oaUBaI6O5jGy9R5Q8p/hektqs5xrqRItIg52gTq7qWg3phSJGMvf aZROxUmjEX70rlJq7oImlGyU9t7kJ3Tq2qcHVaJcnuB0oXNnKUBAZ8JC0vwLCC1+/LWa nd1HbmCUN2y1sLCCqaQ468Lp9XAtpL3s3RGmbKOIlhyFgG6TRRJzpigUM0lPkKMgsRBE asrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=s131NxggirtYayrqVgml5tnn47Lq2po2FNWURr3UV60=; b=fQ1SVu4QDySWCDW1+09qwA1lsi1w1U8Yj1K5E5LK2R5PxQwbGnBY2lzIGzSI5GVfZ8 f4/J9l38S+KbZ86oKfq3tZ78dsbb2LftpY6OWQph9xBarm8nMOv4ZRPGymbX+0wUXN7J J5jQ8Ej9Jbv2vkjYMsq1qSVAoVYcbkpJra9wIQlIYvWxTH+I65SiHoxBd8yQBoJVfpj/ VuoTpibqcKUS3/bMSxi9lDDAzXJIgNwD8/Km3RaNC0M+rrf4qjlzb8QpT+wS8epfDgIw kJRSvQ8zUwl7ueRA6T8Lj5RnFJphbpLTSBZumqXgAAkgbi1gpvmm7bLLcP47JFN0LZXl S9eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="up/h7cwe"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b2si439475ioz.27.2021.05.19.14.16.34; Wed, 19 May 2021 14:16:46 -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=@gmail.com header.s=20161025 header.b="up/h7cwe"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353896AbhESOPP (ORCPT + 99 others); Wed, 19 May 2021 10:15:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347156AbhESOPN (ORCPT ); Wed, 19 May 2021 10:15:13 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 104E3C06175F; Wed, 19 May 2021 07:13:53 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id b7so6787024wmh.5; Wed, 19 May 2021 07:13:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=s131NxggirtYayrqVgml5tnn47Lq2po2FNWURr3UV60=; b=up/h7cwepeCuFW+ckvA0R+rz9NuxgcdzFtCroymGVDqws1W/s6gFloH3vRSqhKaE5n omNKmKsgaOAfsWKMoJMoH2rBz6rR+G58CG2/uX6/+fRwjCdCWU5LZmJKJwkuAvICxFxj bNgqvzk9t6A6uyofRjy4yqIIAV7kEitGGWHfwi//1xJId75jyxflFwJDPh++CBCxzjw/ Tio+Bb3vf1SjIYQN+kzQ58TZ/f7gv9mR0qDWMxNC17d157sUxGYylXL+yX+wMrZLpk1a 4WFvdH522N7X4w+pQ3rkG6nN3RDN1u5U3Ve3Ony2u6ReBCCVc2Hv1fv9aRTE2xeLeDiS cl9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=s131NxggirtYayrqVgml5tnn47Lq2po2FNWURr3UV60=; b=kzGQ9etwRbU7KMAie/qKrL0DHWkbGSFawXShReTFNeJv/E6r1EdKyjIkz5+1voAvyS kPao2Ev0FETk5zlaIcOlZngXKDM+Ki4BZvrqaLLUvEsu4hlutXAGfCa8/cxRL8UoYbHG Rj2adKoBJ/ZwgPxyVhe6NWZowHLOnJWosCVErWZx7GEwzHqQs8x07H351U+l8x8JF5BU fygtslrAlRq9PXv+rcdeY2zrCmgaYkGyAhmrUL0PaD/K+HzWdZlLSPbUdpd6f9eJhJt8 LCqVGViZV2a0r9+liv4J1LQDhJ2XR6pcFWomfMX+pHggQ4OkduhX0w967EcX9S2UNFOC vwsA== X-Gm-Message-State: AOAM533OlLXtAQr0gj4g2TuN/ZLgpghgvfd1lAnVyUzq/R6a6Xt3MVAA oxa5wKAySI57vEZSJSsFgf07MaWxsg4EwJ73 X-Received: by 2002:a7b:c8ce:: with SMTP id f14mr11831466wml.81.1621433631479; Wed, 19 May 2021 07:13:51 -0700 (PDT) Received: from localhost.localdomain ([85.255.235.154]) by smtp.gmail.com with ESMTPSA id z3sm6233569wrq.42.2021.05.19.07.13.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 May 2021 07:13:51 -0700 (PDT) From: Pavel Begunkov To: io-uring@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jens Axboe , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Horst Schirmeier , "Franz-B . Tuneke" , Christian Dietrich Subject: [PATCH 01/23] io_uring: shuffle rarely used ctx fields Date: Wed, 19 May 2021 15:13:12 +0100 Message-Id: <485abb65cf032f4ddf13dcc0bd60e5475638efc2.1621424513.git.asml.silence@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Pavel Begunkov --- fs/io_uring.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) 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; - /* 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 { struct io_rings *rings; - /* 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 */ @@ -409,14 +403,6 @@ struct io_ring_ctx { unsigned nr_user_bufs; struct io_mapped_ubuf **user_bufs; - struct user_struct *user; - - struct completion ref_comp; - -#if defined(CONFIG_UNIX) - struct socket *ring_sock; -#endif - struct xarray io_buffers; struct xarray personalities; @@ -460,12 +446,24 @@ struct io_ring_ctx { struct io_restriction restrictions; - /* 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 { + #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; + }; }; struct io_uring_task { -- 2.31.1