From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2656AC433EF for ; Mon, 3 Jan 2022 17:56:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8C5206B0071; Mon, 3 Jan 2022 12:56:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 84D0B6B0073; Mon, 3 Jan 2022 12:56:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6EF0A6B0074; Mon, 3 Jan 2022 12:56:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0052.hostedemail.com [216.40.44.52]) by kanga.kvack.org (Postfix) with ESMTP id 0B2D66B0071 for ; Mon, 3 Jan 2022 12:56:26 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id C0EE48249980 for ; Mon, 3 Jan 2022 17:56:25 +0000 (UTC) X-FDA: 78989730330.25.26C9764 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf29.hostedemail.com (Postfix) with ESMTP id 9EF9212000A for ; Mon, 3 Jan 2022 17:56:17 +0000 (UTC) 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 CFB7D21108; Mon, 3 Jan 2022 17:56:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1641232582; 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=CWXmfQBKbsotJ+DKTiOu/dBjpnMA9AO60pYklnpK268=; b=RhtzrMx8l25Gp/dHfXaSGxIrVaiGPT1oHmkDlXhSWyOvA3XmL4u7MKmkETxcTTsnSdyvu2 2jQ+42aJxQsIJcy8XiqzBTF5lvvMOIEw62rvN/I2Cv3SEGwEYtC0RgDlqOLKfcdrrpJrAI TwUGB6+/291CiiyPqlt5NX4O2jOPKt4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1641232582; 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=CWXmfQBKbsotJ+DKTiOu/dBjpnMA9AO60pYklnpK268=; b=t8qwh7PKelubXDsAPcP//m32DqwLxiSz3osyPqIC0+7efv+uVAzzP9TnLLkkHY3hH0TlrX HpPoN6SxQtgI3lBg== 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 40BC413B0C; Mon, 3 Jan 2022 17:56:22 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Wx1+DsY402GiJQAAMHmgww (envelope-from ); Mon, 03 Jan 2022 17:56:22 +0000 Message-ID: Date: Mon, 3 Jan 2022 18:56:21 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Content-Language: en-US To: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Matthew Wilcox , Christoph Lameter , David Rientjes , Joonsoo Kim , Pekka Enberg , linux-mm@kvack.org, Andrew Morton , patches@lists.linux.dev, Alexander Potapenko , Andrey Konovalov , Andrey Ryabinin , Andy Lutomirski , Borislav Petkov , cgroups@vger.kernel.org, Dave Hansen , David Woodhouse , Dmitry Vyukov , "H. Peter Anvin" , Ingo Molnar , iommu@lists.linux-foundation.org, Joerg Roedel , Johannes Weiner , Julia Lawall , kasan-dev@googlegroups.com, Lu Baolu , Luis Chamberlain , Marco Elver , Michal Hocko , Minchan Kim , Nitin Gupta , Peter Zijlstra , Sergey Senozhatsky , Suravee Suthikulpanit , Thomas Gleixner , Vladimir Davydov , Will Deacon , x86@kernel.org, Roman Gushchin References: <20211201181510.18784-1-vbabka@suse.cz> <4c3dfdfa-2e19-a9a7-7945-3d75bc87ca05@suse.cz> From: Vlastimil Babka Subject: Re: [PATCH v2 00/33] Separate struct slab from struct page In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=RhtzrMx8; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=t8qwh7PK; dmarc=none; spf=pass (imf29.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 9EF9212000A X-Stat-Signature: kgq4mmcpqg887j7apkt93mfgqfnnu4ow X-HE-Tag: 1641232577-89432 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 12/29/21 12:22, Hyeonggon Yoo wrote: > On Wed, Dec 22, 2021 at 05:56:50PM +0100, Vlastimil Babka wrote: >> On 12/14/21 13:57, Vlastimil Babka wrote: >> > On 12/1/21 19:14, Vlastimil Babka wrote: >> >> Folks from non-slab subsystems are Cc'd only to patches affecting them, and >> >> this cover letter. >> >> >> >> Series also available in git, based on 5.16-rc3: >> >> https://git.kernel.org/pub/scm/linux/kernel/git/vbabka/linux.git/log/?h=slab-struct_slab-v2r2 >> > >> > Pushed a new branch slab-struct-slab-v3r3 with accumulated fixes and small tweaks >> > and a new patch from Hyeonggon Yoo on top. To avoid too much spam, here's a range diff: >> >> Hi, I've pushed another update branch slab-struct_slab-v4r1, and also to >> -next. I've shortened git commit log lines to make checkpatch happier, >> so no range-diff as it would be too long. I believe it would be useless >> spam to post the whole series now, shortly before xmas, so I will do it >> at rc8 time, to hopefully collect remaining reviews. But if anyone wants >> a mailed version, I can do that. >> > > Hello Matthew and Vlastimil. > it's part 3 of review. > > # mm: Convert struct page to struct slab in functions used by other subsystems > Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> > > > # mm/slub: Convert most struct page to struct slab by spatch > Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> > Tested-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> > with a question below. > > -static int check_slab(struct kmem_cache *s, struct page *page) > +static int check_slab(struct kmem_cache *s, struct slab *slab) > { > int maxobj; > > - if (!PageSlab(page)) { > - slab_err(s, page, "Not a valid slab page"); > + if (!folio_test_slab(slab_folio(slab))) { > + slab_err(s, slab, "Not a valid slab page"); > return 0; > } > > Can't we guarantee that struct slab * always points to a slab? Normally, yes. > for struct page * it can be !PageSlab(page) because struct page * > can be other than slab. but struct slab * can only be slab > unlike struct page. code will be simpler if we guarantee that > struct slab * always points to a slab (or NULL). That's what the code does indeed. But check_slab() is called as part of various consistency checks, so there we on purpose question all assumptions in order to find a bug (e.g. memory corruption) - such as a page that's still on the list of slabs while it was already freed and reused and thus e.g. lacks the slab page flag. But it's nice how using struct slab makes such a check immediately stand out as suspicious, right? > # mm/slub: Convert pfmemalloc_match() to take a struct slab > It's confusing to me because the original pfmemalloc_match() is removed > and pfmemalloc_match_unsafe() was renamed to pfmemalloc_match() and > converted to use slab_test_pfmemalloc() helper. > > But I agree with the resulting code. so: > Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> > > > # mm/slub: Convert alloc_slab_page() to return a struct slab > Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> > Tested-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> > > > # mm/slub: Convert print_page_info() to print_slab_info() > Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> > > I hope to review rest of patches in a week. Thanks for your reviews/tests!