Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1648044rdb; Thu, 7 Dec 2023 05:21:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IHmsIjZlA9MjpCTzfAZDR1oNYLtQVGUyfZINO+8HJGaEVaqlSQaM9vXLT72a1wzcoo9cNl2 X-Received: by 2002:a05:6a20:9186:b0:18b:844d:778f with SMTP id v6-20020a056a20918600b0018b844d778fmr3405883pzd.12.1701955302990; Thu, 07 Dec 2023 05:21:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701955302; cv=none; d=google.com; s=arc-20160816; b=YGnv/OHdPKQk5IhLQEB0A62Z1SvyBXWR0t0n/2TZlEJSCiFr0VDmsLSF3Y/CjkRVLq xHwqcbBEaB5HHxwstTzVhCtLztMkE1loj3/SmSOnseBTRD36l99t5wlIW8QvMIzpvRIM nlDEIJthwDd/kFn/8TXM9rjsZtKJubN22+NBak68fxgZ9V7mzvUlj/Rp8zkQ6yFuC4vs HuGvoXgD5/uX071f/BfgegrRyZtW3/YbSi37lcH9oFJMm43nsFUbVhisNJAdEz27ijJY qRayU9I5iMZ39l9oEwei7n5LZ/jLq7BiG5W/R6WX1kQT+cAjLTLonh+z7s4EPGgKBFRX zmTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=hlxnIkTVs+MeF68tCsmk/nR1vv5URTWbbq/XkKatOUM=; fh=R0jjQ6F/fZ6nQt5coTQ2z37qcsdfV2mnAvaXqY7Ldpc=; b=Yec9oCdMCWRkGi8aiQicfQbgnpjXeqTn+SojD4gAoztQ/5fY6kdE63Kx2v/0Owix/T XnRGLVdyLmylfB+dEhelY12zvOkypXBqoieMbfwUWQtOpP4qZis27cK6qfZc875rT7JM 2W4N4E4z2yOct/S2UNXQEOVnFxSadICtmwdQ9gToWo92+qHixr9G9J3+vj6GPU2JsxHM hfDLBrf4X2GSjlITo7FWZTN2tK3C/AkVTGa5Ls87S4vyGXZB8km/bp+JnOK0SJIzSkhz A8mjru/FFfzds+xg18RQfTc8WiVBUxCJxAfWvG/GybliMx3p3L5Ak6gHd+8XBQlqUzUI mlig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VASoLc3T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id t8-20020a056a00138800b006ce7c7570c6si1239264pfg.288.2023.12.07.05.21.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 05:21:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VASoLc3T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id A897F8042C1F; Thu, 7 Dec 2023 05:21:38 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232728AbjLGNVZ (ORCPT + 99 others); Thu, 7 Dec 2023 08:21:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229949AbjLGNVX (ORCPT ); Thu, 7 Dec 2023 08:21:23 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0AA1AA for ; Thu, 7 Dec 2023 05:21:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701955289; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hlxnIkTVs+MeF68tCsmk/nR1vv5URTWbbq/XkKatOUM=; b=VASoLc3T4fHEot6tOntF8ZRlz0DARTVmt8/XuFeiOHXFw2zGVoxUEROvD73gbvMvuSGOe5 0a+H1scnD5EYJqLBLT70GxXv8VFPAUyO5LULYEUilMX1gCuwakFSQyfbBo2UviXpvsrz2Q pIKkb4+6Whxi9xD79ZGNyDiBjSdgRug= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-668-jCRHf0RGOiK98jxr_VOP_w-1; Thu, 07 Dec 2023 08:21:22 -0500 X-MC-Unique: jCRHf0RGOiK98jxr_VOP_w-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 58B3C3813F28; Thu, 7 Dec 2023 13:21:22 +0000 (UTC) Received: from [10.22.32.209] (unknown [10.22.32.209]) by smtp.corp.redhat.com (Postfix) with ESMTP id AFB23492BE6; Thu, 7 Dec 2023 13:21:21 +0000 (UTC) Message-ID: <0a79501b-ff60-4122-840f-fc0095ae05fd@redhat.com> Date: Thu, 7 Dec 2023 08:21:21 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH-cgroup] cgroup: Move rcu_head up near the top of cgroup_root Content-Language: en-US To: Yosry Ahmed Cc: Tejun Heo , Zefan Li , Johannes Weiner , Yafang Shao , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Stephen Rothwell References: <20231207043753.876437-1-longman@redhat.com> From: Waiman Long In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Thu, 07 Dec 2023 05:21:38 -0800 (PST) On 12/6/23 23:51, Yosry Ahmed wrote: > On Wed, Dec 6, 2023 at 8:38 PM Waiman Long wrote: >> 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? Fair. I will update the patch description to give more details about that. It is new to me too before I got a compilation failure report in linux-next. Cheers, Longman >