Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4860497rdb; Fri, 15 Sep 2023 14:54:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGM3CSvD9bPeWBnwu1nk8/SXCBGsowKj5DAd7xvvTQvLpG76Un1+pX5UqxpsHl0bC1tBZB3 X-Received: by 2002:a17:903:1c1:b0:1c0:ecbb:182f with SMTP id e1-20020a17090301c100b001c0ecbb182fmr3300932plh.5.1694814852019; Fri, 15 Sep 2023 14:54:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694814852; cv=none; d=google.com; s=arc-20160816; b=ae8fsY1veL7aExbtVms7AYul225TDu/rZGAE3DU0FjX1FNbkdggn8yNVUK9lzzd41t b7jdqeOtkzPHMZMQDGWP08BhVcW3UPjjjcsr6ZVFyZMhywn6JjkGIHnQhNseFt+8SOCN BgWM1thIITt/bLVpnW+V4500V0+MKnN5O7AsgEc8W2PdZEg5Djf7HFIPKFrwJZKCFL4Z OnNzid0vhu83AaXSMPgszJNERCzbxTNUTYVCcm9VZ/XMks101kWo12dvBSdAe3BIMi9y LNaG+dbbsmvWc2HtpVay5z027mQh/9EBjkFRAdr1/qX6luG4zuO5J3UP+/x1FdoM3dGM eMJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2grCxcqK8FKtyCgTOlZ0MTRPcri5sYlchrmngCOgl8U=; fh=kl+S4GAUWD1kOeoqBopscteh2mu3DZslcHc01dOJ6TI=; b=dwZvp/0dhOqtcDytPXOu/AYC7Cz1ktRzu4ow1gwY16c8+ru6+qPeZNtrSvXgKCbNx/ kKzY9qnc8gKsbNzIRERIwsXcZdjY1sey5ujQtwl6bAFEHP59gJRnwkOap3kl2xuQUXbe pqifDGu2mMTm6VJhOXy4Jx7XmcqNKHuXidGHt5LLW1zV+rkRlsuupVjJV/ZpCV8WRaGF 6r+uN924ZGD132glfMmroR6y3gs044FhHBSXM8MERshYCpkZghgBAHV977Nv247lYHRI olT2ywWzRVzHkstHhKoqYPIHLpCTSjn0DyYIDGI8X6awwZfz9gV882WtUdUqKa0RlN+4 dtJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b="j/WoRm7k"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id y10-20020a170902864a00b001bc836180dcsi3883709plt.520.2023.09.15.14.54.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 14:54:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b="j/WoRm7k"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 0B4C880984BA; Fri, 15 Sep 2023 11:41:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236442AbjIOSk0 (ORCPT + 99 others); Fri, 15 Sep 2023 14:40:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236936AbjIOSj7 (ORCPT ); Fri, 15 Sep 2023 14:39:59 -0400 Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [IPv6:2001:67c:2050:0:465::201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC4FF49DA; Fri, 15 Sep 2023 11:39:11 -0700 (PDT) Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (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-201.mailbox.org (Postfix) with ESMTPS id 4RnNJD57K5z9sW2; Fri, 15 Sep 2023 20:39:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1694803148; 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=2grCxcqK8FKtyCgTOlZ0MTRPcri5sYlchrmngCOgl8U=; b=j/WoRm7kqZ2NoZ5OjDxKOQdGsBPUtApoPN7xyVBhTkrQsnhPqztuwiVWc2+UMXFhXmucnn yV+5CVecVrEDZ/RgmtLrE4lsA0aMvZFUc6TXMrY/E0TUv11fr40etSwDNW4JstoTE3PGdc wzKsqHxrr54nqKGxraGFN5jT4guAQfbru8I95DPokA3ewiwi5qz50a3aIhjBlV9pFFIWnV /3j3RMZ/xhGVgtsWXbHphYwPMEotMMqn+UED9KX4/9IgzyhYXmjjJeptgYB1o9oG1BDw5K SfyVH8Havcutw80kiMU8+RDv5/rYTA2MFLmQBkfN08ZgPi5O8qpzk1LIGJ1oUw== 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 06/23] mm: call xas_set_order() in replace_page_cache_folio() Date: Fri, 15 Sep 2023 20:38:31 +0200 Message-Id: <20230915183848.1018717-7-kernel@pankajraghav.com> In-Reply-To: <20230915183848.1018717-1-kernel@pankajraghav.com> References: <20230915183848.1018717-1-kernel@pankajraghav.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 15 Sep 2023 11:41:06 -0700 (PDT) From: Luis Chamberlain Call xas_set_order() in replace_page_cache_folio() for non hugetlb pages. Signed-off-by: Luis Chamberlain --- mm/filemap.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mm/filemap.c b/mm/filemap.c index 4dee24b5b61c..33de71bfa953 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -815,12 +815,14 @@ EXPORT_SYMBOL(file_write_and_wait_range); void replace_page_cache_folio(struct folio *old, struct folio *new) { struct address_space *mapping = old->mapping; + unsigned int min_order = mapping_min_folio_order(mapping); void (*free_folio)(struct folio *) = mapping->a_ops->free_folio; pgoff_t offset = old->index; XA_STATE(xas, &mapping->i_pages, offset); VM_BUG_ON_FOLIO(!folio_test_locked(old), old); VM_BUG_ON_FOLIO(!folio_test_locked(new), new); + VM_BUG_ON_FOLIO(folio_order(new) != folio_order(old), new); VM_BUG_ON_FOLIO(new->mapping, new); folio_get(new); @@ -829,6 +831,11 @@ void replace_page_cache_folio(struct folio *old, struct folio *new) mem_cgroup_migrate(old, new); + if (!folio_test_hugetlb(new)) { + VM_BUG_ON_FOLIO(folio_order(new) < min_order, new); + xas_set_order(&xas, offset, folio_order(new)); + } + xas_lock_irq(&xas); xas_store(&xas, new); -- 2.40.1