Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1717551rwe; Fri, 2 Sep 2022 02:35:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR4EhT/eWBGyFowIC28GnPN5JRDjQORKaMZ/3OhnfXuLl9I8mo9WlTphlA9c/pQNqcBqdwNK X-Received: by 2002:a63:8a43:0:b0:42b:347d:4ad7 with SMTP id y64-20020a638a43000000b0042b347d4ad7mr29074525pgd.188.1662111326598; Fri, 02 Sep 2022 02:35:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662111326; cv=none; d=google.com; s=arc-20160816; b=sWxwQsIUMnvukcCkLvYDHRVhlQLe/yrDRSsPrHI7euRcY9ONsufkceMSdF5mThUGe+ mvsWsQonkIU49fhWAli27z1TQbOY1t4nvE7jU0P5bI2kx0kA4un75gpHKFanxfxJ9jz7 XiU2nsZATaVQQNNpfIRB7g+9hj3DpCkiLIeybSiG/ua/fgVUSjDdvNjETnOmnmeEAI78 /MODVvfCN1uKXW71t62B4N8DVooR8E6rHrRbDQK4UoxMhKmvvVMpUL91p4VpREBe6x54 s7AtMw2ZJyFfhsxxCXkr6d8NBYCff+z6nQy46nwubnVCZRvHDQPD38fpZ3KuZ0n4gQcq pN/A== 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:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature:dkim-signature; bh=Rd3pA8qgIDU8b5TFfRtTYXB5vFvZyeLlgLZGMf5H4xA=; b=YrRnP5Rq9QvXziUZlV7tk76AiTOdEotqk9cdnlaKxS8XU72lUy1bJDIw4N9t/CogHq Vvydd8u295rrVMmszW93v7jPxd32TF399sLjK7s3nDr7iaNNOp1xpwYgEcKgcsxB/EMt kmtDsHkw0K/Am+jEZfjJH/gqJ6q1kkiVrl5pqI8qM8LDLEEozXzqdxK88eudWSuuob2y WGAC1MDSJ2yrFOUgvrMUzqtsRlN0NiHm2qNiKcc0Y2u2d/fOXKJcJZswjJSYtNoDWFLH UIl6D1Qp4xXD/OwOddAbfgBkc00dQ8yv/d6C4uyo8Rn0BsEOZhOhT/9YgX56srM/pMhN EvLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=GFigYEkm; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e4-20020a170902744400b0016d5d09a43dsi1521303plt.331.2022.09.02.02.35.13; Fri, 02 Sep 2022 02:35:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=GFigYEkm; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235061AbiIBJbH (ORCPT + 99 others); Fri, 2 Sep 2022 05:31:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235568AbiIBJac (ORCPT ); Fri, 2 Sep 2022 05:30:32 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 389302C67D; Fri, 2 Sep 2022 02:30:22 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id CF738342A7; Fri, 2 Sep 2022 09:30:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1662111020; h=from:from:reply-to: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=Rd3pA8qgIDU8b5TFfRtTYXB5vFvZyeLlgLZGMf5H4xA=; b=GFigYEkmlXk35LHz5yFJR9FZflvsV06MWtczzY6e4BHvfMKWxhaTDECJrMkGR97r1/XxSf tDAb5fcR0XnKs5NgRKD/14Db53Z9BeBaARjhbGSEaa9ZFDEmtE35t1esbi3mAXSasOXmCP NFFgAdnVZzKcvsy6FlA6Grj7SezicZM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1662111020; h=from:from:reply-to: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=Rd3pA8qgIDU8b5TFfRtTYXB5vFvZyeLlgLZGMf5H4xA=; b=GqkxwC7jobr70fRwxJZncNc5CZwwtb3n21oJMDKEf3Y4GNsnWOYENYgnKr4gLLh4Fm5sWe nxfQ0pJQWzxSVuBA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A543413328; Fri, 2 Sep 2022 09:30:20 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ORWWJyzNEWNsFAAAMHmgww (envelope-from ); Fri, 02 Sep 2022 09:30:20 +0000 Message-ID: <75ad3ed3-7dcd-474c-472c-ca32c1734281@suse.cz> Date: Fri, 2 Sep 2022 11:30:20 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.0 Subject: Re: [PATCH v5 02/18] mm/sl[au]b: rearrange struct slab fields to allow larger rcu_head Content-Language: en-US From: Vlastimil Babka To: "Joel Fernandes (Google)" , rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, rushikesh.s.kadam@intel.com, urezki@gmail.com, neeraj.iitr10@gmail.com, frederic@kernel.org, paulmck@kernel.org, rostedt@goodmis.org, vineeth@bitbyteword.org, boqun.feng@gmail.com, Hyeonggon Yoo <42.hyeyoo@gmail.com> References: <20220901221720.1105021-1-joel@joelfernandes.org> <20220901221720.1105021-3-joel@joelfernandes.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/2/22 11:26, Vlastimil Babka wrote: > On 9/2/22 00:17, Joel Fernandes (Google) wrote: >> From: Vlastimil Babka >> >> Joel reports [1] that increasing the rcu_head size for debugging >> purposes used to work before struct slab was split from struct page, but >> now runs into the various SLAB_MATCH() sanity checks of the layout. >> >> This is because the rcu_head in struct page is in union with large >> sub-structures and has space to grow without exceeding their size, while >> in struct slab (for SLAB and SLUB) it's in union only with a list_head. >> >> On closer inspection (and after the previous patch) we can put all >> fields except slab_cache to a union with rcu_head, as slab_cache is >> sufficient for the rcu freeing callbacks to work and the rest can be >> overwritten by rcu_head without causing issues. >> >> This is only somewhat complicated by the need to keep SLUB's >> freelist+counters aligned for cmpxchg_double. As a result the fields >> need to be reordered so that slab_cache is first (after page flags) and >> the union with rcu_head follows. For consistency, do that for SLAB as >> well, although not necessary there. >> >> As a result, the rcu_head field in struct page and struct slab is no >> longer at the same offset, but that doesn't matter as there is no >> casting that would rely on that in the slab freeing callbacks, so we can >> just drop the respective SLAB_MATCH() check. >> >> Also we need to update the SLAB_MATCH() for compound_head to reflect the >> new ordering. >> >> While at it, also add a static_assert to check the alignment needed for >> cmpxchg_double so mistakes are found sooner than a runtime GPF. >> >> [1] https://lore.kernel.org/all/85afd876-d8bb-0804-b2c5-48ed3055e702@joelfernandes.org/ >> >> Reported-by: Joel Fernandes >> Signed-off-by: Vlastimil Babka > > I've added patches 01 and 02 to slab tree for -next exposure before Joel's > full series posting, but it should be also ok if rcu tree carries them with > the whole patchset. I can then drop them from slab tree (there are no > dependencies with other stuff there) so we don't introduce duplicite commits > needlessly, just give me a heads up. Ah but in that case please apply the reviews from my posting [1] patch 1: Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> patch 2 Acked-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> [1] https://lore.kernel.org/all/20220826090912.11292-1-vbabka@suse.cz/