Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1476052lqj; Tue, 4 Jun 2024 02:44:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW6EhzDiBM+G+oRzoZh8ualzfH0uxk30ezMe7JI+OACaG24MrJvYbL9TcHJ95k9DYT6pwqPnQ88zwB9xUSQ1snDIKUeasrYCQUBpG2pyQ== X-Google-Smtp-Source: AGHT+IH5IORZJvwEKelOI/fpTbZs/WcCtXWn7XHJpvgQc0hPwP+fnEWdkUrt+HR5qhf3Ci2oh3MI X-Received: by 2002:a05:6a20:9796:b0:1b2:15ae:fad7 with SMTP id adf61e73a8af0-1b26f319ddemr9325347637.59.1717494265426; Tue, 04 Jun 2024 02:44:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717494265; cv=pass; d=google.com; s=arc-20160816; b=SJSJylZC+RFH2s02O9IwL3cmN940uqQTIYjiNRipabf+TnV2j5q+wAnWitfp2C5YW/ fTcRsnccmJPvEmhzk7sP8EybEXuCwfriiMIKpD+urXEGDTQWHqW6vUVBY6JAHegqgyHV K3fL6oDzT48cmV8saWlFcSyfP8jGGEr4Xjxi3IWGrHpILE7rA0MjiBj+xPHtJWdRqH1T B4fPN+S6oJ6RA8+Ze3FhWgdJo4zkK4/eRQrDvmQxno3434TLSdGYxPMZIcwzb1u0oBFL EadzEQoqDjsxdeqEUyhJx//SP8+I3KSePSIzi0yxzogYgkrmS0aMF+OeKsEs4zA85jBN ieIw== 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=BwfviVSUVjyzK7z0Oz8qcwUlgiOXWr8u7z2/yepDw0E=; fh=zdlpYOFPQVSnY1yuuAgszbPxKcvjKTkVdGgcZVAG5H8=; b=Ifn7oNcxw/DR9IiWnu1mGQo8x6z4sRtPx4ekPp4jdV8Rz+0rBO2QsPX60qdyCg72x8 /cGladWCQ+iO1gDxEAYTIWNUlHKOP9zJLhQZiNX5/S0Geim0+lP6X76WJ7xcXQL1o8tU sF2Iasn0RZCVSgnE43pcj3jgtIAgHVhDLX/xc8p5/4Ci+jV0Y/Q/n5aPzyuqyX/JDkk2 rDzbjO3ZeYo2Lxd5uEZ0uF4oZnbILqaQkpv+o+GFlftSP+mWzFY8tm5tfzMJoZ6d2Pah lAqSBHIrgW7MyQJ6YSEbECT2+B1ZWbubEyjGO09CPB0sjFpLiu1I4OhjCEKwZY5s+ltb FxRg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=BhxBAtgY; arc=pass (i=1 spf=pass spfdomain=pankajraghav.com dkim=pass dkdomain=pankajraghav.com dmarc=pass fromdomain=pankajraghav.com); spf=pass (google.com: domain of linux-kernel+bounces-200376-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200376-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pankajraghav.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1f6323dd6f6si78872425ad.264.2024.06.04.02.44.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 02:44:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200376-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=BhxBAtgY; arc=pass (i=1 spf=pass spfdomain=pankajraghav.com dkim=pass dkdomain=pankajraghav.com dmarc=pass fromdomain=pankajraghav.com); spf=pass (google.com: domain of linux-kernel+bounces-200376-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200376-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pankajraghav.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 42938B21D19 for ; Tue, 4 Jun 2024 09:43:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B987C15E97; Tue, 4 Jun 2024 09:43:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pankajraghav.com header.i=@pankajraghav.com header.b="BhxBAtgY" Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) (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 EA00F12B17B; Tue, 4 Jun 2024 09:42:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.152 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717494181; cv=none; b=omglR+4pu6aIoyRYLgE9HMTJKDtyDP9CvkUi5hT2SCh0vVczP6JrK32CtB3p2UFv7LXpgvAsFulTk4O6RbgwOveM1vB4hFP+89VsELF0ylDDk6wxR4pRhI3XDUSH/4hKfZK9+NfYr9XSTv7ACpwaZvynONXAxYk0ea8bAHtiZEw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717494181; c=relaxed/simple; bh=MA1mKVUFSQbibfU52Ruzr7yQn+NzA2FeGtM1hmfDuTo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ML7StcBJ2SGpzGbOvAjQzLIqGONh1UZx6Kv1whUj2NyieRXDmKBi1XmpO7X6LcJsT3A0jJxEKRS3xgHBPeAy26MQGELt1lIJm7q7KM1LCCaemtNE0zzgWuEwozNiUSmSPN8a5zKpsKaDTuBgNNJJqQ+janJLNzFIBiaHm5jxs1c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pankajraghav.com; spf=pass smtp.mailfrom=pankajraghav.com; dkim=pass (2048-bit key) header.d=pankajraghav.com header.i=@pankajraghav.com header.b=BhxBAtgY; arc=none smtp.client-ip=80.241.56.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pankajraghav.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pankajraghav.com Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4Vtly2399bz9swF; Tue, 4 Jun 2024 11:42:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1717494170; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BwfviVSUVjyzK7z0Oz8qcwUlgiOXWr8u7z2/yepDw0E=; b=BhxBAtgYhyhzPeOgmDqd34ZmUeefBR+MfK7CU65OVl+qKZoeSu7FVj9jW2Yr2xBqz9f+r9 3ex9Ri1OiQGpL1UkdDImUVZUWHGVarixU1UKzZU9mfn2DHPiB6XHxoeeFKXEe/a40KTUxg sNFnRK149QKjw64Sa1vXgM2HIWt1zD9v+cxhjKCXMDBY+d3Q5/0wmj8vA5AbtfSoVDThLp igxWkSSOnahjECeHmWBYZFdIQxY8Ks1o1YVDyoVau8Hs8SyOKqbOT4t6IrIfgBW/9wYKet 5BV2x1wNgCjnHAXATAQjCl4SiKrI+C+rBAuScByIpi7TjNNMCFQJMEya2imJaA== Date: Tue, 4 Jun 2024 09:42:45 +0000 From: "Pankaj Raghav (Samsung)" To: Matthew Wilcox Cc: david@fromorbit.com, chandan.babu@oracle.com, akpm@linux-foundation.org, brauner@kernel.org, djwong@kernel.org, linux-kernel@vger.kernel.org, hare@suse.de, john.g.garry@oracle.com, gost.dev@samsung.com, yang@os.amperecomputing.com, p.raghav@samsung.com, cl@os.amperecomputing.com, linux-xfs@vger.kernel.org, hch@lst.de, mcgrof@kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v6 03/11] filemap: allocate mapping_min_order folios in the page cache Message-ID: <20240604094245.zn5hqezd5q5eoehv@quentin> References: <20240529134509.120826-1-kernel@pankajraghav.com> <20240529134509.120826-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: On Mon, Jun 03, 2024 at 01:18:45PM +0100, Matthew Wilcox wrote: > On Wed, May 29, 2024 at 03:45:01PM +0200, Pankaj Raghav (Samsung) wrote: > > @@ -1919,8 +1921,10 @@ struct folio *__filemap_get_folio(struct address_space *mapping, pgoff_t index, > > folio_wait_stable(folio); > > 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); > > > > if ((fgp_flags & FGP_WRITE) && mapping_can_writeback(mapping)) > > gfp |= __GFP_WRITE; > > @@ -1958,7 +1962,7 @@ struct folio *__filemap_get_folio(struct address_space *mapping, pgoff_t index, > > break; > > folio_put(folio); > > folio = NULL; > > - } while (order-- > 0); > > + } while (order-- > min_order); > > I'd argue you also need to change: > > - if (order > 0) > + if (order > min_order) > alloc_gfp |= __GFP_NORETRY | __GFP_NOWARN; > > since that is the last point at which we can fall back. If we can't > immediately allocate a min_order folio, we want to retry, and we > want to warn if we can't get it. That is a good point. It is also a feedback to the admin if they start using LBS and assess the memory requirement based on memory alloc warning? -- Pankaj