Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1832945rdb; Thu, 7 Dec 2023 09:53:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IHypXubqbsSmeOx4C/JO+YMEzxch0KMVTJw2rF6AThduTH76/75xKwPCZSGBosskvdHYj0Z X-Received: by 2002:a17:902:7004:b0:1d0:4c09:7d31 with SMTP id y4-20020a170902700400b001d04c097d31mr2866391plk.65.1701971622387; Thu, 07 Dec 2023 09:53:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701971622; cv=none; d=google.com; s=arc-20160816; b=AfdFJNggIMdi7MIiiU3OFhXorGklDJM02x+2tHRpdHaGRKsscy3xBKj7KEZTBqT6fK EHu6cO1BTRwwdcUikIhbLBAPKyh5sJIBDU1SnOX7qxOxZXnip3BuY8JoSy+SPU3RXudw qlnNlFhvrpEncXG4kB8dQoBe5muxKT9wDXqfXsdWtlu3771OXAjq6FwFV3oB3Hk5Xn55 GIoCPX2CMnvKEGPFwdRd3yKBpa9DUHykEuCR2g2JZ11kxPMuFUdTFjhdxq4NDOsbyqH+ heZqewLTNpsyEd3mhU0qxYP0xVC8xRPxTa8hOLi9AD9/bCXWoj9y6s2S6g/Ry3PmwdlW Jo3A== 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=Ej8XOnCH2VsZ/qShm6gnD6DULhgsDhDu14Fz2jUUZmE=; fh=LbiKl7QKN3YdQvJOYGikGywTA6zQGNI4xuNPGASuYvo=; b=W+5V11Ux3FrI11sHNWnF9v+jA6OmKp+Ahktj2wAxITlIiXpm8SWfmPSSuapUvne5+K 3NzUiVDCkJN9duAOEw7qQq28I0C+egxr0J3sph9qpZGh7F+Uqqj+LUIPyVvYQTm06hid PM2mwZJQaOc+fic/F1Llp0uq/422G/9FR8xVftgUMnlACV0R+tJXQdpeOIKUEttsgjaI tcPgvxMkZNirhn2WDUXgRmAJPDOjhkO1r8+B6Ya7f1xnwVRj7CEA4J1YKbd2+s2XxvAL CeVj5qG/Xc0qfwwoQ/a01y7InL2fYQcwe+it+4QreprHxhhLRXraXMF3uK33DvniHDh3 tLEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ZPgQg+it; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id 13-20020a170902c10d00b001cfa718038esi100947pli.388.2023.12.07.09.53.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 09:53: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=@google.com header.s=20230601 header.b=ZPgQg+it; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id F205E826EBAD; Thu, 7 Dec 2023 09:53:39 -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 S1443576AbjLGRx2 (ORCPT + 99 others); Thu, 7 Dec 2023 12:53:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443447AbjLGRx0 (ORCPT ); Thu, 7 Dec 2023 12:53:26 -0500 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 831C410CF for ; Thu, 7 Dec 2023 09:53:32 -0800 (PST) Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2ca0f21e48cso13953821fa.2 for ; Thu, 07 Dec 2023 09:53:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701971611; x=1702576411; 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=Ej8XOnCH2VsZ/qShm6gnD6DULhgsDhDu14Fz2jUUZmE=; b=ZPgQg+itvxzN5Vw5a/c662emHmOeBkmMXS1vW3e6UWjkrUKmHz1p8BtKukTJsUp+w3 LNL+xUafOLP9JcDbxxbIwiVA+rYrtBNRPq2PjZQoDw5q45u2aa2f1e1XdI2O0FtzZr+w o9Htppcy1HzHCPs1x2+nsOzi6/p5fo3qJvgs6symtiueJ0qIFEoKgiOGScYmJqVjOI3h TVDEFDxv2Npm66IHUs/wAgkuizAEulmOQh8W+1YP0oDjuVKTWcCZiR6Nve9i+n5JN17p CVLlCn29aWm/5MtbD0H7gYpCk2we/FIjdEQtYP6e93fJ5QJupdZr9ieLs9MOCxklvajU 8rqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701971611; x=1702576411; 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=Ej8XOnCH2VsZ/qShm6gnD6DULhgsDhDu14Fz2jUUZmE=; b=BiHXfJOsg1DcKpxqa5lDBpE8n8K6kqpGLDC5kZZWTFP3t8FnIpjoPMerRo6yOc6a/p SP1Pge7gn37quSFyOo6YCtQFA567gWz+Pi2KD17FkhWVE8lRXW9unRF/BYIPW6ypBRue r8tCONmlM/5zcMiT+4MrFUA6TtZjlU3b1e4WCsm0E0lEM2ZU048XSFrgFGo1hUwQVbTc ode0vWNcKKvyrg4tB5DSQ4fvCZ3Gn8/n4izQ5lPFHzeTzXs31LMBLj9wE9aV2PyQmZ/i UKoQ1IHUKkeBnVxw/NxK5oToGQ809+q+BcSQv8JRkMhr6SniP5gY4qq0A2t0TWj4G+Ni xO3g== X-Gm-Message-State: AOJu0YwgXrg7VO4EDnDXSOGV/MaeR+mLoXjgWriblp1oYQ7uCl5PYCKQ qQ164cBwGb1WUjvgIFq7tWl1hCXvsGRLC0JzH6s5x8faLMxCSSOqaA4= X-Received: by 2002:a2e:98d7:0:b0:2ca:286:4b1c with SMTP id s23-20020a2e98d7000000b002ca02864b1cmr1948479ljj.91.1701971610472; Thu, 07 Dec 2023 09:53:30 -0800 (PST) MIME-Version: 1.0 References: <20231207134614.882991-1-longman@redhat.com> In-Reply-To: <20231207134614.882991-1-longman@redhat.com> From: Yosry Ahmed Date: Thu, 7 Dec 2023 09:52:54 -0800 Message-ID: Subject: Re: [PATCH-cgroup v2] 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 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 09:53:40 -0800 (PST) On Thu, Dec 7, 2023 at 5:46=E2=80=AFAM 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 current implementation of kvfree_rcu(), however, has the limitation > that the offset of the rcu_head structure within the larger data > structure must be less than 4096 or the compilation will fail. See the > macro definition of __is_kvfree_rcu_offset() in include/linux/rcupdate.h > for more information. > > By putting rcu_head below the large cgroup structure, any change to the > cgroup structure that makes it larger run the risk of causing build > failure under certain configurations. Commit 77070eeb8821 ("cgroup: > Avoid false cacheline sharing of read mostly rstat_cpu") happens to be > the last straw that breaks it. Fix this problem by moving the rcu_head > structure up before the cgroup structure. > > Fixes: d23b5c577715 ("cgroup: Make operations on the cgroup root_list RCU= safe") > Reported-by: Stephen Rothwell > Closes: https://lore.kernel.org/lkml/20231207143806.114e0a74@canb.auug.or= g.au/ > Signed-off-by: Waiman Long > Acked-by: Yafang Shao Reviewed-by: Yosry Ahmed