Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1431991rdb; Wed, 6 Dec 2023 20:53:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IHjVzm9zJL+KD+Tk2S4CGOvcJRyS0FbgjqormPLjYECyuwr0PgZCtoA6/taqah7JBJlH/21 X-Received: by 2002:a05:6870:818:b0:1f9:e965:191d with SMTP id fw24-20020a056870081800b001f9e965191dmr2380967oab.56.1701924780503; Wed, 06 Dec 2023 20:53:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701924780; cv=none; d=google.com; s=arc-20160816; b=S/4Ok3y0EMwLkPbYJgKqRMUtXTy0J2rc7w7mAeh9ik4wcJw85ScYf/r3rHYQ3bo60J jIouApI0IsVjImV+MZOW86KamVrqPTWOAZJNppV9DFnzcK8BZ0dyM9LZ4MGDZjMDnahi GwjS0dv1snU610Ujs8UEn0sQWgdCIawguCV6N3x3S/X6osqsgsXQjB+UwQbMVOibq0BP 7YnCQbFyUq6Bowy/F1LoLlmO2RDXzAtVc8w4ftXYZTpVQ72Ct2xD8T3sc9D/61LKFt9h 2rA3vhMoVwvzOaJRcEN2zaECYrTTq1M3MeMCeKH6XlS+JjJ+n3eBxqewtK2e1FtJ7I3F 5KXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=+W1jLERIf0/mZcB/EwuwKYXs+J1GUC7lw1ozHshVhi8=; fh=LbiKl7QKN3YdQvJOYGikGywTA6zQGNI4xuNPGASuYvo=; b=TGiyF5kyudJnnOhWwJMfsDStZWs8wo+6XLLynTwlfsv/RZum7wfKu0B55Uzufxm2f4 vafyUlO0Oxo96TjqlgUs6GaF8TopFQ+27Oz9xUbJc4ONSmY3VSWbEDHL3SiC2sSnAgfO j0c54r56CCS28OnUnqjy0ER5jTvlfKzMnH+K3OvqFWV+ATE9YMHg8AXf0flroPZjLeEc fozeay96o4W/sWvyGUZWKcpXrTIsXFlfJtu4wvaHQZmG9VG69D+3OZWBKmwjtDmGmdTN St9uIf2iR65QmohkNAHoExA74DvkYqV5PirFEpzcK03AxC3YE+Xc40bqW2oh5ResJvSq eduQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=LmmyYr5F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id n7-20020a654507000000b005c5e2118e11si498706pgq.70.2023.12.06.20.53.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 20:53:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=LmmyYr5F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id BE9DC8087259; Wed, 6 Dec 2023 20:52:57 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229965AbjLGEw2 (ORCPT + 99 others); Wed, 6 Dec 2023 23:52:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230070AbjLGEwY (ORCPT ); Wed, 6 Dec 2023 23:52:24 -0500 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7B1D10C0 for ; Wed, 6 Dec 2023 20:52:26 -0800 (PST) Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-54c77e0832cso633565a12.0 for ; Wed, 06 Dec 2023 20:52:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701924745; x=1702529545; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=+W1jLERIf0/mZcB/EwuwKYXs+J1GUC7lw1ozHshVhi8=; b=LmmyYr5FfhKtpMih88oqNC7r4uk1FsJuf40yQpeDkpL5BqCQMh+x+R13Y+I2OUadbU 2fXh2iHSDMJrveSJtiknK74OX/5uzGyYU1fvu4pQbVysrkIKdmX+Bxw1qbgTQEIBQgU0 OnYIb7F6dgbBnhNvSTMMjRTRrv8bsnLWSxTh0/Od1AMHynHbQtTo1RBjrxgc9+pczAmR MHySSdGG6OjvoOUwiVKGrQlCydV+YgoOX5sM9LiBuL6izR1G+bNi9E9d6UYXR56pN1/g POESlfc6bd5LVoeRKxNEYdtHJdwPQnWQodiGIypHVq9t25zDKxEWrh/B0/Go0ZWBxOgP kmRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701924745; x=1702529545; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+W1jLERIf0/mZcB/EwuwKYXs+J1GUC7lw1ozHshVhi8=; b=kZyA0UC9zugBqKrAUG1toShw1pltzlgNXrfocdWsgJWKc4pb/okyHg6Ql97OTqpy47 cuosMk/l2qCMg8QhTBYaeT6m5zNoxv2rkYpy50Ys73pYWZH0QP5F57pxc2OZmWyHMjt+ pURG3ehXj/HeEfFOZVGI1ULGecB3HlbB4LrLMNSInn/sGjNJEkKr6vflgPV/UYXWroDI uCjNfY7dea+rUB3CrQFbUDXSlKn8PjRnqKV14whhZvGEUOYku8UrvXjrRbbHvzjPp+0E QubYhVNLBkq6BKX0Sc+Av6JSrG0uOvnbnBadgU5DheUptwPi35ML3kl77cyaYGu2ILjJ HFeg== X-Gm-Message-State: AOJu0YyTjeDCnGJDYuXTyFwkqN39UXC45RQKZ9G2DkkwtQ0Zfc5laEX8 fu/0UaWA1sEKXWWXVhdhN4XmgR5q+pUK56p8E8dVkw== X-Received: by 2002:a17:906:ca50:b0:a02:ad84:3ab3 with SMTP id jx16-20020a170906ca5000b00a02ad843ab3mr1044738ejb.44.1701924745165; Wed, 06 Dec 2023 20:52:25 -0800 (PST) MIME-Version: 1.0 References: <20231207043753.876437-1-longman@redhat.com> In-Reply-To: <20231207043753.876437-1-longman@redhat.com> From: Yosry Ahmed Date: Wed, 6 Dec 2023 20:51:46 -0800 Message-ID: Subject: Re: [PATCH-cgroup] cgroup: Move rcu_head up near the top of cgroup_root To: Waiman Long Cc: Tejun Heo , Zefan Li , Johannes Weiner , Yafang Shao , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Stephen Rothwell Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 06 Dec 2023 20:52:57 -0800 (PST) On Wed, Dec 6, 2023 at 8:38=E2=80=AFPM Waiman Long wro= te: > > Commit d23b5c577715 ("cgroup: Make operations on the cgroup root_list RCU > safe") adds a new rcu_head to the cgroup_root structure and kvfree_rcu() > for freeing the cgroup_root. > > The use of kvfree_rcu(), however, has the limitation that the offset of > the rcu_head structure within the larger data structure cannot exceed > 4096 or the compilation will fail. By putting rcu_head below the cgroup > structure, any change to the cgroup structure that makes it larger has > the risk of build failure. Commit 77070eeb8821 ("cgroup: Avoid false > cacheline sharing of read mostly rstat_cpu") happens to be the commit > that breaks it even though it is not its fault. Fix it by moving the > rcu_head structure up before the cgroup structure. > > Fixes: d23b5c577715 ("cgroup: Make operations on the cgroup root_list RCU= safe") > Signed-off-by: Waiman Long > --- > include/linux/cgroup-defs.h | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h > index 5a97ea95b564..45359969d8cf 100644 > --- a/include/linux/cgroup-defs.h > +++ b/include/linux/cgroup-defs.h > @@ -562,6 +562,10 @@ struct cgroup_root { > /* Unique id for this hierarchy. */ > int hierarchy_id; > > + /* A list running through the active hierarchies */ > + struct list_head root_list; > + struct rcu_head rcu; > + Perhaps the comment should mention the placement requirements, and maybe a pointer to wherever it is specified that the offset of struct rcu_head should not exceed 4096?