Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3263491ioo; Sun, 29 May 2022 19:28:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxACYnC1odxp8ANUcEiRcqe8gZ1b8nmR6u0ZJR+KJpibZPXl8LHRnPsSb7qePLOGZ9zPLFz X-Received: by 2002:a17:902:a9c9:b0:161:5b73:5ac9 with SMTP id b9-20020a170902a9c900b001615b735ac9mr55038873plr.14.1653877681841; Sun, 29 May 2022 19:28:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653877681; cv=none; d=google.com; s=arc-20160816; b=CFS8Z+LNaEhl3evwvlOfUdpDxBK1CTo7j9ejurDkt9ydEAdsEAMYTNc3yp4N0YmlSi 7X5zTebrbyXH/NludxpEyp0H6VTjbAstKoSprt0hMvpErKvhDkabtXfS6w2UkVe1QaoY 6yV7P9/3/qkDqZ+rvjA2Sg7lXMqUsh894nq4eQ5+KuLhVRGz6jHB1ZB1hjEq5UEmJE4C DmknoFBjqFom8S9joITggsDsAs69cUQPm/5D2+tGNZgpP7ByFBC6ZV2TUtyIF33zQ4b6 0rcJkNv3EoR4S+OuuCglsRU4sKD7oYpnys9dmFTzT81jw6SocWmenYiafl8+m4ASeeBM z5nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=WYOLX8HovA/BSABYfgTLym5uG30L/Fgf5B8DvAQCglM=; b=Y4zMNAmtq0m1m6rr2tQg3iFvbFMdkepD9W6LfeFEpYuXo8gV1QkjjuqY601gZbz2gP Qqi216P/3uLUmr9Ov6HJvP/rMon5JNDyOau7UTJE11iztgGCdGyk5+AwOiMvhzS3pNaC BnWzeEfyaAiNLGW6F/LkxnD1m4zbIOBOUXbxBbaZUWSwGk0t3gxzIhCsn61ml0wci/0U MSQdQB39imhKMfy/wt5oBPw2gkIYJ8pqzGhU/jQTqHFMoca6h/ZdzPsOzTHdGGb9S348 ton+6Ikqnr6vSrxK2basX2knOwlz8cx3XQsL/WoBLUZakaoOamPtuGxMA5yeZizI1As5 pecQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=n5o4AXUo; 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 y1-20020a056a00190100b0050df2e4ba29si12982238pfi.139.2022.05.29.19.27.42; Sun, 29 May 2022 19:28:01 -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=@infradead.org header.s=casper.20170209 header.b=n5o4AXUo; 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 S232009AbiE3Azk (ORCPT + 99 others); Sun, 29 May 2022 20:55:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229603AbiE3Azj (ORCPT ); Sun, 29 May 2022 20:55:39 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBADE4D9FD for ; Sun, 29 May 2022 17:55:37 -0700 (PDT) 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=WYOLX8HovA/BSABYfgTLym5uG30L/Fgf5B8DvAQCglM=; b=n5o4AXUoeoibvMO9u8F1b5yvw7 TTLeNItWqJ56F6zta27N7u0ANmjcGNabXIBDLpQLCWrA3jYk0U68XL0JoSfPsOvHha0gRYNWra33x wjyasGcb4ACtDISXoJ1twG6+MwFsGQY2n0bQgPR5vE26VqRZ8bRp3hcXrkztb5LI3ENBDrNTzwRbA ZjF+MYSa3mbHiEUl1LPTRiolvqr2n28FTEWACfz/0HmutNHE9Nk+asWElTT0jDgSUyxFTTAxqStXn 0O7kfc0mW67T3+JFNyTPgeIW0qIKciljthZ5yRKyxHK2mhHPAZLPLfDqTCTsY/rLQICTbLbQ3oicD 32Av8IkA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nvTgg-0042qA-Mf; Mon, 30 May 2022 00:55:14 +0000 Date: Mon, 30 May 2022 01:55:14 +0100 From: Matthew Wilcox To: Muchun Song Cc: bh1scw@gmail.com, Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , Roman Gushchin , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/slub: replace alloc_pages with folio_alloc Message-ID: References: <20220528161157.3934825-1-bh1scw@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,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 Sun, May 29, 2022 at 04:31:07AM +0100, Matthew Wilcox wrote: > On Sun, May 29, 2022 at 10:58:18AM +0800, Muchun Song wrote: > > On Sat, May 28, 2022 at 05:27:11PM +0100, Matthew Wilcox wrote: > > > On Sun, May 29, 2022 at 12:11:58AM +0800, bh1scw@gmail.com wrote: > > > > From: Fanjun Kong > > > > > > > > This patch will use folio allocation functions for allocating pages. > > > > > > That's not actually a good idea. folio_alloc() will do the > > > prep_transhuge_page() step which isn't needed for slab. > > > > You mean folio_alloc() is dedicated for THP allocation? It is a little > > surprise to me. I thought folio_alloc() is just a variant of alloc_page(), > > which returns a folio struct instead of a page. Seems like I was wrong. > > May I ask what made us decide to do this? > > Yeah, the naming isn't great here. The problem didn't really occur > to me until I saw this patch, and I don't have a good solution yet. OK, I have an idea. None of the sl*b allocators use the page refcount. So the atomic operations on it are just a waste of time. If we add an alloc_unref_page() to match our free_unref_page(), that'll be enough difference to stop pepole sending "helpful" patches. Also, it'll be a (small?) performance improvement for slab.