Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2435754rdh; Sun, 29 Oct 2023 16:38:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEM1XAWj29mk/FbFWF68Vk/LBUum0UMaTzMzHt2ApnZi5WozpUhsex0y9Bneo9I3gri+J0H X-Received: by 2002:a05:6e02:1be7:b0:357:4fab:e24c with SMTP id y7-20020a056e021be700b003574fabe24cmr13771590ilv.13.1698622683306; Sun, 29 Oct 2023 16:38:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698622683; cv=none; d=google.com; s=arc-20160816; b=HR6WfW94nmsjfGQEZrwfLMbu6CUeprWBVr7pxXgl7jOr/u8+/TvxsB9cYze9n9Oe4g MwGo/FVLVL/pRw+im19v5qr74mtA8FUo0ZU7Rcz2mAs/h7VFtpjxEemYK+BZ9uzMd/W0 85fiA2El40em8W7v4KSQpWUwQ2kEuX85dyVYD2FhbdZQxOOt60owT+8qylG6nvf1utVu yDZ8HvSeGWCAyuE/LiqyV9mXkwcbSnwjpRKB0ctaQ0hKFzg2LwppDGZyV/ZsdP5g3iqL XcBvyIH1caWMchZKAI6KeUJILsgOvlQr89UY4r/QC9GZTRTDrMgSY9ds5PUqgwTFCH9a n2yw== 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=guqQZMi+S1KSEFshVxWJ2luwQG5HPiCtpJaksTTmti0=; fh=ardmABoZqyzAm25ow9fvqe18o8v8L1P0+Wo2I9sPHpg=; b=K6XiEphy/UMtbETE/h2QpXbMuTVw58RzZZjLP9fBL0yEjlZliAUKDU/SC+PX+eU5aW HWOPFo1Qx4frUkAINJsM0w7BdaD0YjqyNzlxKMy4yAK8WFZHBpcVyvDVZgmfRU3rn5dP Mp6oGU5qY2Z0UlDU1xVgoVzryR/IcDtxEtuEyp8FH/eUEVYt9TwQ0pi5uXsWXymBevtU Kr8v19OVXg5t/s42TQSvqZsU/Dq5CCVAnaeU7T5KOZC25n1GEkjtFVd19jPekcL/4Yav cqPkdbVJDNHLU5xofPmQnPbBshCVdDSyZPqMcXH39k6yWRfMruTadmlX/lZmsxatpWeO 76uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Wo7WerlJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id v7-20020a056a00148700b00691019fd0efsi4098933pfu.75.2023.10.29.16.38.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 16:38:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Wo7WerlJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 7F1C580A1A37; Sun, 29 Oct 2023 16:38:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231868AbjJ2Xhm (ORCPT + 99 others); Sun, 29 Oct 2023 19:37:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229533AbjJ2Xhd (ORCPT ); Sun, 29 Oct 2023 19:37:33 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1D836E9B; Sun, 29 Oct 2023 16:32:18 -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=guqQZMi+S1KSEFshVxWJ2luwQG5HPiCtpJaksTTmti0=; b=Wo7WerlJhEgpQrY5ZBqa6AaM+u eR4dg/eHjvkTjQbqX3tLPPXvNPE/bgtdqm1WwiIVWjI11m6B+kDspU0GRBMULp/1I6L+mq3E66aQR G81NXlVt2ghXmGThaHLgGX+uWJWG68FiQYpLF5c/gYQ0+8U9ahKnxx8x7a2/gnce4PjMEvuxF6LcO e6b9sE5jh55LZ4Wic4UMfTL6J6IrCQnWpwdlV5NJfNbgu6FgVRFyhSvzl5p8UEUltyq4aPUR70u/B HeZ/L0OladO+JRwUOK4qruG0SWBCzPxw53IVJ+nOKiXvRld2K/OTG9HZdS2/pG3d/R2jC7WFHuN50 vaepK3Tw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qxFGJ-000jDh-MM; Sun, 29 Oct 2023 23:32:07 +0000 Date: Sun, 29 Oct 2023 23:32:07 +0000 From: Matthew Wilcox To: Daniel Gomez Cc: "minchan@kernel.org" , "senozhatsky@chromium.org" , "axboe@kernel.dk" , "djwong@kernel.org" , "hughd@google.com" , "akpm@linux-foundation.org" , "mcgrof@kernel.org" , "linux-kernel@vger.kernel.org" , "linux-block@vger.kernel.org" , "linux-xfs@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-mm@kvack.org" , "gost.dev@samsung.com" , Pankaj Raghav Subject: Re: [RFC PATCH 10/11] shmem: add large folio support to the write path Message-ID: References: <20230919135536.2165715-1-da.gomez@samsung.com> <20231028211518.3424020-1-da.gomez@samsung.com> <20231028211518.3424020-11-da.gomez@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231028211518.3424020-11-da.gomez@samsung.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Sun, 29 Oct 2023 16:38:00 -0700 (PDT) On Sat, Oct 28, 2023 at 09:15:50PM +0000, Daniel Gomez wrote: > +++ b/mm/shmem.c > @@ -1621,6 +1621,9 @@ static struct folio *shmem_alloc_folio(gfp_t gfp, struct shmem_inode_info *info, > pgoff_t ilx; > struct page *page; > > + if ((order != 0) && !(gfp & VM_HUGEPAGE)) > + gfp |= __GFP_COMP; This is silly. Just set it unconditionally. > +static inline unsigned int > +shmem_mapping_size_order(struct address_space *mapping, pgoff_t index, > + size_t size, struct shmem_sb_info *sbinfo) > +{ > + unsigned int order = ilog2(size); > + > + if ((order <= PAGE_SHIFT) || > + (!mapping_large_folio_support(mapping) || !sbinfo->noswap)) > + return 0; > + > + order -= PAGE_SHIFT; You know we have get_order(), right?