Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp184053rdh; Tue, 13 Feb 2024 13:29:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW33rzJN7SgL8/55pll0LR3L+DZWe87VprIfqLg/dhEkGf+AWyhm3wBFvhoObbJK0iJ+2vHwUu5ZAtbKxM88Jg3EKEr5TfQPK2xr8224w== X-Google-Smtp-Source: AGHT+IGgrCvotyfU4jCdgzy2ZHAaZx+jajW62LU1/T+3uUVJfGY9J8oy8DS0MrViYcxSZeVrkH9m X-Received: by 2002:a05:6358:7522:b0:176:92d1:568f with SMTP id k34-20020a056358752200b0017692d1568fmr606966rwg.18.1707859767452; Tue, 13 Feb 2024 13:29:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707859767; cv=pass; d=google.com; s=arc-20160816; b=B+SEi5wa0qszz52AI3jj+OkwUuJzsVLuuN76cxbJPSMR4dYk346Q2W3fJ/vxCpV7Bb piKIpwkF3rt+TwZo4FiDCZVWEJEZBldV85p7CVGiT1gAUAH3+BT8wRJOTe3pzEFQ1mjO q44GpOgfPqbvhMfT2CmNmJLk8J3oYJGGr5Prb4cHkCun39V7h+QxKRmY6pFzdYRrCUgL psvdaHmzVN1ts3+lFfEQy6UVDbch82mVCsl/iHMvsnBZvqQjgAvLVuj+gysTUbqfNMXw fHTdUPbRW0EfYUv8Gh4tZFIYyIIqY5Dz/jh+2hCeQ7yTQxDvDoIN8H8Y/zKso6oMht1l CkBg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=+J5TbqElkYdwn8/aa4Gu5bIjM9KJLszZYGfTrxi53pU=; fh=nnflwebOShNAbsJ1FF47hl308U1k/b+ibSg0FcNkA80=; b=n3VHe4ZaoiL+dYSQctdT3htAbMj0rkPpt+yXTTQa/pfUf8wnhnG6AxHA3nMMIznnvf s7ncpBLSYlVBsjGs0d6YczbHVhLHqcggs2v5uFHwWeC3gh0xzXNe4hX6fuC6tu3jW1QI h4st8r2GOcT9qmSBBex7z6X6eJW58ns+j8YHbUggDxPJfAlWJOezQRj0AQBbhFdmshO8 rVMskoFME1HEvtjd++aY1W2RrSnWXvPgVfeJe2UKiPuXKMSB0ZEnaaRT5pp1ZCmpKfZW El1PaP5NeZmEC9iO6rcHy7rOZbLLnNLZgRrMCFz06PyzrqyN+0YIKLSbVjT47k8avn/i HHkA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Tw2vRvgv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-64330-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64330-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCUwDw69nl43txMv3uAzaA6tENbVnWETTbDuAlepweRxBFYN6qJ5RMiLoGsDfMmEU7sc+/srPFUv/FSKt71KnSHY1S5fTHJwwKooZkMMlA== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 201-20020a6302d2000000b005dc43133d78si2446152pgc.87.2024.02.13.13.29.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 13:29:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64330-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Tw2vRvgv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-64330-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64330-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1972128DB35 for ; Tue, 13 Feb 2024 21:29:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F1C406167D; Tue, 13 Feb 2024 21:29:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Tw2vRvgv" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B902612DF; Tue, 13 Feb 2024 21:29:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707859757; cv=none; b=RttSJUzCbFAjxmVTbTCU6bgZWSa39n5lNh0SDVJENWYMQGUAHPqymHblpoKeMes4QBYPrkFesO/vr0CVjaN/9hpWTjmhxzkq2KcGd02N8HA6qEJOmW22BNAcbzMWCK/ukRBhzkkuMVdVdBJ1vQ756DnRL0a4mO7h/Edycn4UIBw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707859757; c=relaxed/simple; bh=QClImjY1lYcfORamVxbILEkRAbA7o0MUEXBX6cK6mdo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dQsXjNqaaZUzpj7twwKtnWTIWNjp4vW43wEnmq45drMFTIusEt/mXUnxvqDAdiyd5DTCb25ehbmKErBJfyEM4qtcK2AihmRIqeldoD6ishEhHqGdcz0nhyO7iNKBJ1QfR4KHNwPK92RfP3Cs5NLiAHasGgh7us4W2zB7llq2rSY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Tw2vRvgv; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DDE0C433F1; Tue, 13 Feb 2024 21:29:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707859756; bh=QClImjY1lYcfORamVxbILEkRAbA7o0MUEXBX6cK6mdo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Tw2vRvgvBGoL0Ybzyb89j9Y1Lm4agG8oAyI/KLsbv3TRTZOvVBQCjGbNELkZdSC19 gpRw2yOJELK7gbM82zJ28/vuizg6p0Zt9gme8w7eEhoH7nYgW/dakZeWvM8k7VT6Ka QXLqI2SttC5f+otkU1PkmVz4crUdpqcBV7kDsO08/S2/g2bl7Nlqi0hwW5N9KvDJXR 3neoJi0i0g2NpSg+CqOuCk3yP+mCS7T4u/skbEPqkj86JzM1y9POHMvvzgp7/gzkjm pYxrrB1WQDGmyO6My01WjdOh2FATKOWemRL0m/T4587jN1wLfe9HXOcRtS0GFiW2EO Mr2rUD9JKmtMw== Date: Tue, 13 Feb 2024 13:29:14 -0800 From: "Darrick J. Wong" To: "Pankaj Raghav (Samsung)" Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, mcgrof@kernel.org, gost.dev@samsung.com, akpm@linux-foundation.org, kbusch@kernel.org, chandan.babu@oracle.com, p.raghav@samsung.com, linux-kernel@vger.kernel.org, hare@suse.de, willy@infradead.org, linux-mm@kvack.org, david@fromorbit.com Subject: Re: [RFC v2 01/14] fs: Allow fine-grained control of folio sizes Message-ID: <20240213212914.GW616564@frogsfrogsfrogs> References: <20240213093713.1753368-1-kernel@pankajraghav.com> <20240213093713.1753368-2-kernel@pankajraghav.com> <20240213163431.GS6184@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Feb 13, 2024 at 10:05:54PM +0100, Pankaj Raghav (Samsung) wrote: > On Tue, Feb 13, 2024 at 08:34:31AM -0800, Darrick J. Wong wrote: > > On Tue, Feb 13, 2024 at 10:37:00AM +0100, Pankaj Raghav (Samsung) wrote: > > > From: "Matthew Wilcox (Oracle)" > > > > > > Some filesystems want to be able to limit the maximum size of folios, > > > and some want to be able to ensure that folios are at least a certain > > > size. Add mapping_set_folio_orders() to allow this level of control. > > > The max folio order parameter is ignored and it is always set to > > > MAX_PAGECACHE_ORDER. > > > > Why? If MAX_PAGECACHE_ORDER is 8 and I instead pass in max==3, I'm > > going to be surprised by my constraint being ignored. Maybe I said that > > because I'm not prepared to handle an order-7 folio; or some customer > > will have some weird desire to twist this knob to make their workflow > > faster. > > > > --D > Maybe I should have been explicit. We are planning to add support > for min order in the first round, and we want to add support for max order > once the min order support is upstreamed. It was done mainly to reduce > the scope and testing of this series. > > I definitely agree there are usecases for setting the max order. It is > also the feedback we got from LPC. > > So one idea would be not to expose max option until we add the support > for max order? So filesystems can only set the min_order with the > initial support? Yeah, there's really no point in having an argument that's deliberately ignored. --D > > > +static inline void mapping_set_folio_orders(struct address_space *mapping, > > > + unsigned int min, unsigned int max) > > > +{ > > > + if (min == 1) > > > + min = 2; > > > + if (max < min) > > > + max = min; > > > + if (max > MAX_PAGECACHE_ORDER) > > > + max = MAX_PAGECACHE_ORDER; > > > + > > > + /* > > > + * XXX: max is ignored as only minimum folio order is supported > > > + * currently. > > > + */ > > > + mapping->flags = (mapping->flags & ~AS_FOLIO_ORDER_MASK) | > > > + (min << AS_FOLIO_ORDER_MIN) | > > > + (MAX_PAGECACHE_ORDER << AS_FOLIO_ORDER_MAX); > > > +} > > > + >