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 192F9C433F5 for ; Sat, 11 Dec 2021 16:53:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 64A9A6B0072; Sat, 11 Dec 2021 11:53:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F9FE6B0073; Sat, 11 Dec 2021 11:53:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4C1556B0074; Sat, 11 Dec 2021 11:53:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0195.hostedemail.com [216.40.44.195]) by kanga.kvack.org (Postfix) with ESMTP id 3C9E16B0072 for ; Sat, 11 Dec 2021 11:53:08 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id E0CF789078 for ; Sat, 11 Dec 2021 16:52:57 +0000 (UTC) X-FDA: 78906107994.15.9F2AC56 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf06.hostedemail.com (Postfix) with ESMTP id 96066180006 for ; Sat, 11 Dec 2021 16:52:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=u/N0Z1R4JJJOrnFGUtTYcDRphW4OI/ZTkZQ/n5WMmxo=; b=BAKk3TlOpDapjy+sRZ5EwPj9XL EW+Xw1yKvik4prj+1S5dwaee8Wi1otnWT5eQd09a/q4iJGPFGMss9Q4sD5QyXMKDt/I1D+BQ11FfF LkCJDdd89XQmKiXTMXfaQ9WSaXb4ctBhY0ZDOk4Mh6uGKPiiLYDbsTFn9rJ59CBn/nE69rGmPFJI7 zyz9SVGOkWxh4aKb5EiR4acweKJpzBpNeWr44DfR+fWDXE6v8bdv7xN42jkh8rHEUenIfCowRvHQF noKgz8PWjRVTHL1jUwHyOUgSH1NyNgrn5dL6vVSHW1Dku1BAUMYFaeuKAmXNLeYO9vkJUQlqyoR34 NbujTehg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mw5c7-00BKuT-BZ; Sat, 11 Dec 2021 16:52:47 +0000 Date: Sat, 11 Dec 2021 16:52:47 +0000 From: Matthew Wilcox To: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Vlastimil Babka , Christoph Lameter , David Rientjes , Joonsoo Kim , Pekka Enberg , linux-mm@kvack.org, Andrew Morton , patches@lists.linux.dev, Marco Elver , Alexander Potapenko , Dmitry Vyukov , kasan-dev@googlegroups.com Subject: Re: [PATCH v2 31/33] mm/sl*b: Differentiate struct slab fields by sl*b implementations Message-ID: References: <20211201181510.18784-1-vbabka@suse.cz> <20211201181510.18784-32-vbabka@suse.cz> <20211210163757.GA717823@odroid> <20211211115527.GA822127@odroid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211211115527.GA822127@odroid> X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 96066180006 X-Stat-Signature: g3b7n3nhuq6bgwgd9t1u149ekheaaadf Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=BAKk3TlO; spf=none (imf06.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-HE-Tag: 1639241576-619255 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 Sat, Dec 11, 2021 at 11:55:27AM +0000, Hyeonggon Yoo wrote: > On Fri, Dec 10, 2021 at 07:26:11PM +0100, Vlastimil Babka wrote: > > On 12/10/21 17:37, Hyeonggon Yoo wrote: > > > On Wed, Dec 01, 2021 at 07:15:08PM +0100, Vlastimil Babka wrote: > > >> With a struct slab definition separate from struct page, we can go further and > > >> define only fields that the chosen sl*b implementation uses. This means > > >> everything between __page_flags and __page_refcount placeholders now depends on > > >> the chosen CONFIG_SL*B. > > > > > > When I read this patch series first, I thought struct slab is allocated > > > separately from struct page. > > > > > > But after reading it again, It uses same allocated space of struct page. > > > > Yes. Allocating it elsewhere is something that can be discussed later. It's > > not a simple clear win - more memory used, more overhead, complicated code... > > > > Right. That is a something that can be discussed, > But I don't think there will be much win. Oh no, there's a substantial win. If we can reduce struct page to a single pointer, that shrinks it from 64 bytes/4k to 8 bytes/4k. Set against that, you have to allocate the struct folio / struct slab / ... but then it's one _per allocation_ rather than one per page. So for an order-2 allocation, it takes 32 bytes + 64 bytes (= 96 bytes) rather than 4*64 = 256 bytes. It's an even bigger win for larger allocations, and it lets us grow the memory descriptors independently of each other. But it's also a substantial amount of work, so don't expect us to get there any time soon. Everything currently using struct page needs to be converted to use another type, and that's just the pre-requisite step. Some more thoughts on this here: https://lore.kernel.org/linux-mm/YXcLqcFhDq3uUwIj@casper.infradead.org/ > > Yeah. Also whatever aliases with compound_head must not have bit zero set as > > that means a tail page. > > > > Oh I was missing that. Thank you. > > Hmm then in struct slab, page->compound_head and slab->list_head (or > slab->rcu_head) has same offset. And list_head / rcu_head both store pointers. > > then it has a alignment requirement. (address saved in list_head/rcu_head > should be multiple of 2) > > Anyway, it was required long time before this patch, > so it is not a problem for this patch. Yes, that's why there's an assert that the list_heads all line up. This requirement will go away if we do get separately allocated memory descriptors (because that bottom bit is no longer PageTail).