Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4869321rdb; Fri, 15 Sep 2023 15:11:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEQ+HFMq9ok3bs3lstDXixVt+ufzzFP2iqK/K/LhTeF7rWEkfb3RyPbxw0cOXbh0eNDk6Ba X-Received: by 2002:a17:902:ecc6:b0:1bd:c7e2:462 with SMTP id a6-20020a170902ecc600b001bdc7e20462mr3086284plh.11.1694815879448; Fri, 15 Sep 2023 15:11:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694815879; cv=none; d=google.com; s=arc-20160816; b=SgRuaSRFrZ0RvMIhDpTlKp210wZFRqgrMegRGMBROq6ZVT6zQcJdhYPdLl+zxwXktc OyQgGUDTw/Z6gTIC0QbULLrU8jLGtS/gG0IfLt8dJFBBanvMHo+AXKhD5WpNhdUm9LvH uhiwAEIOxN6OV0+BJW+8JiMqLnsDYqaic5tL6B88aCQ7+wHYTudIrdCfG52KEgeVWg+2 JmDcHVo1/pC/vT3zCDSQJdxijtsJsUICHCHzH64n799h1TAIEDJG6dCoecITYQhYoNsS 6Y+oBRtwAtHNhPkLa5ZcgfkMARnLlpxisoJHOZPC+/b02b+EZn4qPQSeYmckOYW1M5RZ /qjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Y/fSdW0K1l1qEwxoAkr3ut7R4kvgq+96xhgOzZowLQE=; fh=W11qpygqhVl+bKjrif44rQ6UzYM3D5CrbTfnG3zvQNY=; b=ui//7wZUC5/jFbQNKWVSuU3xJx3kTzND3DNmdIiYnWxeYmGA6OBcPyx53o1MmtcQ1/ zB4oh2fgqIoIfQf7K9tZSw489/3Qt7m3hfJvW9z/CPRXqQlCZyjidZxb/NIdX6+tm0l4 YQ4jkHZcG786diD9dTnnA0cUbNIeFV9bJRUzFqMxpnI9mOyHKvXb4hE37nbE8OlTw0yF 0BGWmpQnBtI/OH6nXUq8bBb3axMtyxQ63ThSR7yg1FpRb/65+SW9oQY3U3ROPepi7AbL 3ruEoxiybxTaRHI8HUOUKmYuEYMqWfPlrPp1u7MgZC4HITkuUMyxY8C9eaviuOJwHXMa +gIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=g6HHLtGA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id ky6-20020a170902f98600b001c08a358683si3769652plb.217.2023.09.15.15.11.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 15:11:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=g6HHLtGA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id D27EF82E47D3; Fri, 15 Sep 2023 12:47:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236638AbjIOTqt (ORCPT + 99 others); Fri, 15 Sep 2023 15:46:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236131AbjIOTqR (ORCPT ); Fri, 15 Sep 2023 15:46:17 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A0AB1738; Fri, 15 Sep 2023 12:46:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Y/fSdW0K1l1qEwxoAkr3ut7R4kvgq+96xhgOzZowLQE=; b=g6HHLtGAW2z+LmhyJlCjL9C/gX fIPMB4BW9Wi9o/LMqeRMuUiNz4ujTuj9F6IgYEt+eVO7GRnfJb3O0v0SDVdR+Amn6z2fg1lLtaWOt Ram/r3053lAZ7AOIxW7En+9EurwXX3VkS77aBBWIRbNSutvbDY87xcdW07nK32y7mELbqJe/jyJhg R48gG8ZrGFKp0CdoPzW/dHbrETbFJ7FNJkhj5G2i7Pgwhw4OejbWbzuPSJMeLM99+nctdlCM2CDPu 27A22qTSq2j96CT9eqIz4w3JnX8TU7JzWN2LiouX1jD4OC5wphRf5FDdpQAan5qrjPFFMCO4T1Yey ZQ9SnUKw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qhElW-00Bg3F-Kz; Fri, 15 Sep 2023 19:46:10 +0000 Date: Fri, 15 Sep 2023 20:46:10 +0100 From: Matthew Wilcox To: Pankaj Raghav Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, p.raghav@samsung.com, david@fromorbit.com, da.gomez@samsung.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, djwong@kernel.org, linux-mm@kvack.org, chandan.babu@oracle.com, mcgrof@kernel.org, gost.dev@samsung.com Subject: Re: [RFC 06/23] mm: call xas_set_order() in replace_page_cache_folio() Message-ID: References: <20230915183848.1018717-1-kernel@pankajraghav.com> <20230915183848.1018717-7-kernel@pankajraghav.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230915183848.1018717-7-kernel@pankajraghav.com> 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 agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 15 Sep 2023 12:47:25 -0700 (PDT) On Fri, Sep 15, 2023 at 08:38:31PM +0200, Pankaj Raghav wrote: > From: Luis Chamberlain > > Call xas_set_order() in replace_page_cache_folio() for non hugetlb > pages. This function definitely should work without this patch. What goes wrong? > 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 >