From patchwork Fri Sep 15 18:38:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13387470 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 A6C29EED61E for ; Fri, 15 Sep 2023 18:39:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 335D66B03BF; Fri, 15 Sep 2023 14:39:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2E6A96B03C0; Fri, 15 Sep 2023 14:39:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 184F66B03C1; Fri, 15 Sep 2023 14:39:23 -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 EC81F6B03BF for ; Fri, 15 Sep 2023 14:39:22 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 98A5A140239 for ; Fri, 15 Sep 2023 18:39:22 +0000 (UTC) X-FDA: 81239694564.14.6BF3341 Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) by imf03.hostedemail.com (Postfix) with ESMTP id 01D6D2001E for ; Fri, 15 Sep 2023 18:39:20 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=Zj3MnwSG; dmarc=none; spf=pass (imf03.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.172 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694803161; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=3APo23DtYMF4HiSm9np03AfVKr1TDxQPEqBIBU7EQLQ=; b=aPGIV9WQ5rrSF2mfdCUxLTBXoQhmYpFKIRjRUtchmbbYOfdymY0WplvbgKBOUB1WS5ls8y KuluB3mPVSC9EzVeZ5vZJGuATM5Euok2BaLCfHxhlYadXbDNhL5zomi3GljDfgAcW1EaB2 TLjgEZ4/0a3/jg2HcF1TTkAgDSmIIM4= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=Zj3MnwSG; dmarc=none; spf=pass (imf03.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.172 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694803161; a=rsa-sha256; cv=none; b=1pZjBfOUG1GGirzPuT6mfmePKuiBY985hJcSOeSfQtAFy4Ubj8FSvXnvF/lomth9tGAuPn Lw09dFehoKXg093i46HSlC884PP8X4TBbi8lIMGeXMfSXT2ZEInOa7mmL/VSJBff2vttlv MvhInaMJj9uy9Sh5wubAM70qmg8QwuM= Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4RnNJQ0N8tz9sZ5; Fri, 15 Sep 2023 20:39:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1694803158; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3APo23DtYMF4HiSm9np03AfVKr1TDxQPEqBIBU7EQLQ=; b=Zj3MnwSGDMAwBq1bun9wQMD03apsZ8TkPzzZY0G+xVuRFHlA8jTRS9j0z03rhiuPfuRL6p sz/dnlC30Ddq95aZ8BgLQPzAOrlr7XRSaj2o2j1LWlJXmR+xzOB4D1lfcoHYkXXJNM7T+e o1eXt+BU1FmCmk3Anh7cikxoynzKwfGc8hH7UoHccj4k2DZXzQFOkU0phBCRGBrFG42T8t rlNeZG/822yhWUKUgM45Id9Xd6OxjN5FfHbNRbbHF90yh5ppnDsJruqnEsC/WrQJlyPF8N aYOfhwR5VntP4ab9n0nA+F2XRQXfgH4LmqvrkX9lLSLR7mCEJyhlXYJSK5HJdQ== From: Pankaj Raghav To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: p.raghav@samsung.com, david@fromorbit.com, da.gomez@samsung.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, willy@infradead.org, djwong@kernel.org, linux-mm@kvack.org, chandan.babu@oracle.com, mcgrof@kernel.org, gost.dev@samsung.com Subject: [RFC 09/23] filemap: use mapping_min_order while allocating folios Date: Fri, 15 Sep 2023 20:38:34 +0200 Message-Id: <20230915183848.1018717-10-kernel@pankajraghav.com> In-Reply-To: <20230915183848.1018717-1-kernel@pankajraghav.com> References: <20230915183848.1018717-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 01D6D2001E X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: rne8rgq5446zqosatsu7ng7dpmf6onst X-HE-Tag: 1694803160-324 X-HE-Meta: U2FsdGVkX1+6dnpQrNgwSinfBTMQI0vdJSHda+TzNL9AubLVE0FdsfLftCcS5Ryqck/AsaZ8YIdhIEGY6ZfskILJsvJRnOD8jiHx04ZhuUaDxY4PLenGngonW5o+Cr1EHhE2LgZis+xhB/LfXX+utB8smyl9r6wFPHzPLG9dnqC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xcTxhFBcZ3hlROwf9rtWeCuyquVsoqpamhwr2mC/dVn8nEFuqMcCU/1OY/fukEyEEGoc/V7gpGJDF7wnfWv/8W66SFX/0E13FxVb0LhDvGBuZNhV/qo8zeOnnCf6aZ8= 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: From: Pankaj Raghav Allocate al teast mapping_min_order when creating new folio for the filemap in filemap_create_folio() and do_read_cache_folio(). Signed-off-by: Pankaj Raghav --- mm/filemap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 21e1341526ab..e4d46f79e95d 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2502,7 +2502,8 @@ static int filemap_create_folio(struct file *file, struct folio *folio; int error; - folio = filemap_alloc_folio(mapping_gfp_mask(mapping), 0); + folio = filemap_alloc_folio(mapping_gfp_mask(mapping), + mapping_min_folio_order(mapping)); if (!folio) return -ENOMEM; @@ -3696,7 +3697,8 @@ static struct folio *do_read_cache_folio(struct address_space *mapping, repeat: folio = filemap_get_folio(mapping, index); if (IS_ERR(folio)) { - folio = filemap_alloc_folio(gfp, 0); + folio = filemap_alloc_folio(gfp, + mapping_min_folio_order(mapping)); if (!folio) return ERR_PTR(-ENOMEM); err = filemap_add_folio(mapping, folio, index, gfp);