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 D6974C38150 for ; Thu, 4 Jul 2024 15:20:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5DC5A6B0083; Thu, 4 Jul 2024 11:20:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 58C146B0095; Thu, 4 Jul 2024 11:20:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 453EC6B0096; Thu, 4 Jul 2024 11:20:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 255E86B0083 for ; Thu, 4 Jul 2024 11:20:46 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 98D38C13D2 for ; Thu, 4 Jul 2024 15:20:45 +0000 (UTC) X-FDA: 82302432450.24.5CFCF79 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf24.hostedemail.com (Postfix) with ESMTP id 9B34E180019 for ; Thu, 4 Jul 2024 15:20:42 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="hUt/QK6Q"; spf=none (imf24.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720106431; a=rsa-sha256; cv=none; b=j70hVuNcodKPERxQuNQGNg3GnQkdxO8gzJiQv2Vy3RD/bV5P/KKtBbb96vjIlMAjUQUmaU V0TefW2BGb7YfVG2TNEUIANd91XlzfN9GiQqKsWEBwu1rvQVYX3IbQ0f/JPo0SfIi1xp3H yvWYXXNKvI7w2o2kWdq9N5wX2f6AaII= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="hUt/QK6Q"; spf=none (imf24.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720106431; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=T1W+cwrYdEZzgH6Ohx8queoWljwDE94ghf7And0NMPQ=; b=NCM/qdx0L2xg45jWaY85lTvuY/+Lg+xH4E1/tD9ZfaK9iKRH6AohSdY/HT4cz7prPCD5gG 0M2r/k6IbcFTHtyOLebtKzrbGdFZUzB0dP0EteFYm9NIGVAn1SgilpKXSQbnlqiJfMYzQF G5ZNZGBscjoT6H/JZWMF/LxQ22HG+h4= 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=T1W+cwrYdEZzgH6Ohx8queoWljwDE94ghf7And0NMPQ=; b=hUt/QK6QIkaT0GDYXczMay3Z5A pmDxONmeAqHPE6Ljy1yY/Vm91+/doA5NrrDK0Qwhwytnxn7Ylg0sFitz55Gm0ZLgPkMCwAvCfjr6n 3a1HI8Dn9MsAoLjYVdcTyGWA2WIn8fmctH4PCnIbpZ3hX41eDAdm8bUziFfCU6z7OCmo3Mn1mzZaI vnSZj65ciww3h03aGnLAS30sfEl1Bm5eCEC/HSZZ6Hy3FFxu/3HcekPS0lfRLoUwNGfuYjqu26tCL /myW50CvKTFe+tNi0TCOWfObPVA4DuLa2NhuatSohg5GHb39arRD1HzbIvryZZcBQOMCd3LMo4T5u 1Gt5maMg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPOFp-00000002yac-1247; Thu, 04 Jul 2024 15:20:13 +0000 Date: Thu, 4 Jul 2024 16:20:13 +0100 From: Matthew Wilcox To: Ryan Roberts Cc: "Pankaj Raghav (Samsung)" , david@fromorbit.com, chandan.babu@oracle.com, djwong@kernel.org, brauner@kernel.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, yang@os.amperecomputing.com, linux-mm@kvack.org, john.g.garry@oracle.com, linux-fsdevel@vger.kernel.org, hare@suse.de, p.raghav@samsung.com, mcgrof@kernel.org, gost.dev@samsung.com, cl@os.amperecomputing.com, linux-xfs@vger.kernel.org, hch@lst.de, Zi Yan Subject: Re: [PATCH v8 01/10] fs: Allow fine-grained control of folio sizes Message-ID: References: <20240625114420.719014-1-kernel@pankajraghav.com> <20240625114420.719014-2-kernel@pankajraghav.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: xctiexwbapshbzkhhnamhoftk5kzub1n X-Rspamd-Queue-Id: 9B34E180019 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1720106442-383312 X-HE-Meta: U2FsdGVkX19y8b3YI95nCT+Hl+5V2cyZtcCaiR00tDI7FC0aAW/2Spo2PnZxAnoa52HPAcij9I5Cuw1IFrbO9Zjn6noBTm6wdQANA2cmjgN+UCMhbLJLOBSW+oNkG+Le6Jujp46Ib1h8pYhK8tovJ7cK//424hY//KsLvprpclTpo1802FSr/UOGTbwTPQbPEWpaiew8/gaGIgQdgC1v23zzIRhS2Fs5h2lGazskJLqdEWflXbp1sW0QVy1Y/gCNoxLcrU02FXXfZuvULGkB+83DDws3NhKrE83ypZ2/QiIjEA5KHDUfGCRqqBmn9N7C4SUMLSXGOGdA3jOb7GkFYKaxWCbK+iSksSmIx7FvFZ2C6DYsCdUNIfTTQZuOVSUkHM7Edo1VXz6PsZkXWSnlWS6VHqw/A1KmZqRIl7M1lQhySXrQ0Kvgr7pEpi6UaeA8K8aMCKV5mQPomxYmWD8m3RBI+i66GHeA+iupU4A9ZX9LiNOfhrc/AdvFojVKUdBUEQOj2pj81cerbolu1nxn1vdt4C8EGJ0BrkKvO5uFiiJv85LylYOqT3CeEURUXg53IvgGDeqGBqlr9X1xTHApNq/pZVGwn97Qsxt6fOelBHdBvRQ6ClLAfgoXNXItXD4yMJH6xac3F9zmqKrVw491jma/DdJKb8vL90NMrQB8/XiAZblECQf1vzjmCaI/eLEiL4m3nsahPJVhobCLJC+0nv9IrWThHU0w23tzbUM7lxqRJrWfHYceNCaQFCuqetAYQHE+/5ZPRvrAzGjJCm2Lwz9KmR2Bwqy6em2efPZZdrvaMH1HeKvepemFwzK6aspSgx+d4jbC3+hqPNGMdyAoHM+k/GBbF3XzeX0aAMBbbBmF+mSO/eIfwQdLR19TzB+CssjAM5n5dX3r14y3ajYx1p6eV+lKlz6N03JjHHu47GEK4IUKxsWjVhtQWNQC2p3DLxiTseoUAf3qFY5yHdg /Qf3DOl8 4woi+patJqG8JuxvGJz8eSadgg1QMqqUsvpFOY0v6eGE3rrX35RslQ7Vj/Ls+YlSDApeNZghAkFSqPIhdhy78OzND2ggv2yGbfwv9htPmPx6P/3N6ytHuz8uKAh2n6hoR8rEyJ22mWHM0RlbUS5PbpvvwszMV27jBJM1KhIx6to187zJnWGxD33Lmbtuz+smHTe7Vpc+a7u8mSC+fcCgMGP/KuQod5JELKEZC90JI5H/Bru3xCS8gV9ey1SED5YjL/SENuFFSlhUJ8sM= 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: List-Subscribe: List-Unsubscribe: On Thu, Jul 04, 2024 at 01:23:20PM +0100, Ryan Roberts wrote: > > - AS_LARGE_FOLIO_SUPPORT = 6, > > nit: this removed enum is still referenced in a comment further down the file. Thanks. Pankaj, let me know if you want me to send you a patch or if you'll do it directly. > > + /* Bits 16-25 are used for FOLIO_ORDER */ > > + AS_FOLIO_ORDER_BITS = 5, > > + AS_FOLIO_ORDER_MIN = 16, > > + AS_FOLIO_ORDER_MAX = AS_FOLIO_ORDER_MIN + AS_FOLIO_ORDER_BITS, > > nit: These 3 new enums seem a bit odd. Yes, this is "too many helpful suggestions" syndrome. It made a lot more sense originally. https://lore.kernel.org/linux-fsdevel/ZlUQcEaP3FDXpCge@dread.disaster.area/ > > +static inline void mapping_set_folio_order_range(struct address_space *mapping, > > + unsigned int min, > > + unsigned int max) > > +{ > > + if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) > > + return; > > + > > + if (min > MAX_PAGECACHE_ORDER) > > + min = MAX_PAGECACHE_ORDER; > > + if (max > MAX_PAGECACHE_ORDER) > > + max = MAX_PAGECACHE_ORDER; > > + if (max < min) > > + max = min; > > It seems strange to silently clamp these? Presumably for the bs>ps usecase, > whatever values are passed in are a hard requirement? So wouldn't want them to > be silently reduced. (Especially given the recent change to reduce the size of > MAX_PAGECACHE_ORDER to less then PMD size in some cases). Hm, yes. We should probably make this return an errno. Including returning an errno for !IS_ENABLED() and min > 0. > > - if (new_order < MAX_PAGECACHE_ORDER) { > > + if (new_order < mapping_max_folio_order(mapping)) { > > new_order += 2; > > - new_order = min_t(unsigned int, MAX_PAGECACHE_ORDER, new_order); > > + new_order = min(mapping_max_folio_order(mapping), new_order); > > new_order = min_t(unsigned int, new_order, ilog2(ra->size)); > > I wonder if its possible that ra->size could ever be less than > mapping_min_folio_order()? Do you need to handle that? I think we take care of that in later patches? This patch is mostly about honouring the max properly and putting in the infrastructure for the min, but not doing all the necessary work for min.