Received: by 2002:a05:7208:c250:b0:86:f851:443 with SMTP id w16csp938416rbd; Thu, 13 Jun 2024 01:46:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUslfRZqucoFKZTrniVQOi+k8iI0I1b1mmOT2hSYN/2Msb1rI0sYjRl/4BPFPE0NzjnwE+fzedcaWCZgPXJzYabZzOYrkra7eO6plO3Rw== X-Google-Smtp-Source: AGHT+IH5+UtEQwNpD9K0DpqnA46vJssEUfSHT9gEu3IyyT+UgbVxaBVQNZ41cfEfGlB1Ul2Isv9W X-Received: by 2002:a05:6a20:3943:b0:1b7:edea:e36 with SMTP id adf61e73a8af0-1b8a9c24e08mr4783476637.22.1718268361223; Thu, 13 Jun 2024 01:46:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718268361; cv=pass; d=google.com; s=arc-20160816; b=B505+9uQ7kw/x9d7vk2wQ/ChdFR4AbwZ6d7+uB4XHMY3YPZUxy/6ZJKkpk/ewE4HRc 02hUyb4kLAKfoGqrrUfMwGAmAndqgEBHblrgIP9At9dywCvpt5vvC1JYK+Ee8P7oB+jj oi4/Z/e7gAd1ziZl0fwgy2yNaXwXNx8fh1GP5xlm20Ey0THojuA2dKeP8CfQAWpORYQ3 BV8bvI2zrJ16INzvm24Wh2W2SEX9cVO6Ljly96cHuUxRPXC3ybBDRLsZ9h0SeBnyat2x HmvkuWLZA/60GB+If39iMqT71DiMEI5XwwFtLXccfSdSLqC5FGVeuhs/AdnN4usbXIlE lZ4A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date; bh=VG6S6d11Hfd+8uXal5CftDZb8rQX5abFyRmFczJhnYs=; fh=WY+EXP+0Z/8nNJlQuRNcCQoLfef3+UXTTkI4wdoTqXM=; b=haDJDmVNO8567IIA4gajl/M5f9tQdJqBkSScI40/ydN5w+6dfV/OVD8auO/r3J6lRU 6+GDchcoPxa5db01kEq1oCJiOH0v5i7oMc9/OSqIZuv0fqQ9pJ14DppyaBzALytRh1nB kM4j/NW4lXFLjI4XEZ55H4YySL4EdWQ40a2H+hOad4vf98vyXy1AGCVdCOz7ROfFQV2M qCssnOZvOKY6K0iqHs0uqmH23RMLBu2TyXO/exTTHysjvZpLYuk5IXYnfMa/f9tzqacp 9o/ymSVaA4Zzal06+nfisawYuSNvE4IEjrg1y3iKSoiB6wobpgZyNvNY+G0FHvY3f4EY eMig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=lst.de); spf=pass (google.com: domain of linux-kernel+bounces-212861-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212861-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f855e5161csi8695515ad.132.2024.06.13.01.46.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 01:46:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-212861-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; arc=pass (i=1 spf=pass spfdomain=lst.de); spf=pass (google.com: domain of linux-kernel+bounces-212861-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212861-linux.lists.archive=gmail.com@vger.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 CDF66284736 for ; Thu, 13 Jun 2024 08:46:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7514413F001; Thu, 13 Jun 2024 08:44:18 +0000 (UTC) Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (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 DBA1A13777D; Thu, 13 Jun 2024 08:44:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.95.11.211 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718268258; cv=none; b=WBmQomqJNTfkvzFQKnppImVFJkwZwLBo6drfWoh831iTDrnK2Jl1hoKklK7hFvmcmij7VNH9Z+0wgzFQ9O/KKncCgSNH+dgYApReDigMBFX9Uf/lLBgr9mcyFhz3QlMVqe9+gjiwDGmx9ePCrSjyOEerXk/DcauBQceGIspQG08= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718268258; c=relaxed/simple; bh=NSrOqHEzu2xbZAdhX9ligMyBTflH4RGvPxAtZPprF1A=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NqjrALJKls8RG3T0GLRt0PmPXteNVazjwq3lMymodNUo5M3F6QQ5m7WEUMoSoGQBZ2aGhLRFLD9R/VUAmUdUOH5RE+fiW7Jrig5Xo8zQ909pVbPMbBzQ9a8z4vpjhjKV+aFfQHZaDlAuGLUrLSQHoSB0/fVMppcdE3YcQO1uKik= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.client-ip=213.95.11.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id B74A468AFE; Thu, 13 Jun 2024 10:44:10 +0200 (CEST) Date: Thu, 13 Jun 2024 10:44:10 +0200 From: Christoph Hellwig To: "Pankaj Raghav (Samsung)" Cc: david@fromorbit.com, djwong@kernel.org, chandan.babu@oracle.com, brauner@kernel.org, akpm@linux-foundation.org, willy@infradead.org, mcgrof@kernel.org, linux-mm@kvack.org, hare@suse.de, linux-kernel@vger.kernel.org, yang@os.amperecomputing.com, Zi Yan , linux-xfs@vger.kernel.org, p.raghav@samsung.com, linux-fsdevel@vger.kernel.org, hch@lst.de, gost.dev@samsung.com, cl@os.amperecomputing.com, john.g.garry@oracle.com Subject: Re: [PATCH v7 03/11] filemap: allocate mapping_min_order folios in the page cache Message-ID: <20240613084409.GA23371@lst.de> References: <20240607145902.1137853-1-kernel@pankajraghav.com> <20240607145902.1137853-4-kernel@pankajraghav.com> 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: <20240607145902.1137853-4-kernel@pankajraghav.com> User-Agent: Mutt/1.5.17 (2007-11-01) On Fri, Jun 07, 2024 at 02:58:54PM +0000, Pankaj Raghav (Samsung) wrote: > +static inline unsigned long mapping_min_folio_nrpages(struct address_space *mapping) > +{ > + return 1UL << mapping_min_folio_order(mapping); > +} Overly long line here, just line break after the return type. Then again it only has a single user just below and no documentation so maybe just fold it into the caller? > no_page: > if (!folio && (fgp_flags & FGP_CREAT)) { > - unsigned order = FGF_GET_ORDER(fgp_flags); > + unsigned int min_order = mapping_min_folio_order(mapping); > + unsigned int order = max(min_order, FGF_GET_ORDER(fgp_flags)); > int err; > + index = mapping_align_start_index(mapping, index); I wonder if at some point splitting this block that actually allocates a new folio into a separate helper would be nice. It just keep growing in size and complexity. > - folio = filemap_alloc_folio(mapping_gfp_mask(mapping), 0); > + folio = filemap_alloc_folio(mapping_gfp_mask(mapping), > + min_order); Nit: no need to split this into multiple lines. > if (!folio) > return -ENOMEM; > > @@ -2471,6 +2478,8 @@ static int filemap_create_folio(struct file *file, > * well to keep locking rules simple. > */ > filemap_invalidate_lock_shared(mapping); > + /* index in PAGE units but aligned to min_order number of pages. */ in PAGE_SIZE units? Maybe also make this a complete sentence?