Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2384758rdh; Sun, 29 Oct 2023 13:41:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGHcIx7wsBOT7Q5KGzIeFXCA8+IXPZrpVsdn7GmxlutN6mnXDvt2yON0Mllv7VltMli7N4K X-Received: by 2002:a05:6808:24f:b0:3ae:5a09:9eb9 with SMTP id m15-20020a056808024f00b003ae5a099eb9mr9917432oie.32.1698612080023; Sun, 29 Oct 2023 13:41:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698612079; cv=none; d=google.com; s=arc-20160816; b=WBY1JIGdxlj/he21+HF+p4nBwX54GPyZ2QyIAOwk8sEfG3KeXGuW91FKjNSttf8OBC mm7K1LU0nESFfstKX+uTzXlwrMiTi9BtS16c7av97KaaI3e/JhUlrgsFCpYfp54KA0IC yhsAdKd1sFSUZ6eySHQloTGJn99h9AKf2RCVAxD+2ZWabbVO6M2bFzMWxYI32Mbr4bXk jc2kKK0TxZJlV6q0tzG3NWXtQYq2m44MiAXacNl7MuBYaMNf5U7MwTvgp2p7oYQwW26b d419aV0yL9WJybtg57FL/QaO7oQHF2XgSrpx8nbCcFVl6ETfsLr0Fd9iBAddh5oR7Qa+ OGNA== 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=6waNhTR+o+oIxNaOT4t0XGJ4/XH/ruK+m0W6clw3ZeA=; fh=ardmABoZqyzAm25ow9fvqe18o8v8L1P0+Wo2I9sPHpg=; b=jPtrFYfBC12QZi4wlX82Ft4Ac34+Ena5Swt8RDpF/krzCjsfSkLp/maMpTBCMwcPK+ ybqsVF5bnFACKROW+5GAxJOeWxNWzE1ToSbFag6SB6au1P5R2UI1KRHzdn2hKyz2Wpwq I3DKPgltSr8wDuSRHDAn2lErI/Fxs5j6aFfzm/zJg6pDlcEDNvm9y0cLEjPZVhwt/2ty LzBqT58hN9fn2ybM2EQsLmPdftduxFbgGSRV0l47lPPS8Uwnz/OSIrjWupqq3tevFQRn sbRI/vdQnhDD8wRl83Fa2+mRmsAmzMo+21vaLUqks+EOLeiR7BKo/fl+U7ShBFiyTBDo e3ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Zk7tjG5w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id b12-20020a63e70c000000b0059beadab759si4132661pgi.652.2023.10.29.13.41.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 13:41:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Zk7tjG5w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 1EAD48078622; Sun, 29 Oct 2023 13:41:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230145AbjJ2Ukr (ORCPT + 99 others); Sun, 29 Oct 2023 16:40:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbjJ2Ukp (ORCPT ); Sun, 29 Oct 2023 16:40:45 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C72A5B6; Sun, 29 Oct 2023 13:40:43 -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=6waNhTR+o+oIxNaOT4t0XGJ4/XH/ruK+m0W6clw3ZeA=; b=Zk7tjG5wKVi6QbIzzn68YStq16 57v23MVZQgD9Aaslc6J29o8nzcPpfIaCNICUhBsZBFWuGIm8XfEb4vxCMaSF+dMJyfRZZi07/CGgV sq9JWVeF3tzdsytUaezhQGt7uEt3kznNRVGydmi4wwesl92UY36yqjC/Y0/egKMQP8n3B2Ox84iJE Lck0evHllaksBJxlVP8BALQSRbqJCSTILL45M6shVjKVkGevDSdjIYf7zH7U6neFoLVVttXDNmj/J GqUIRdN4WvbO8XPzALUPUTaYd/OG6DQWnwXvOBFQ6TZazcr+wnSIt0nL0HzyPXE0cerIxNEfumU2Q FN5UO73A==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qxCaJ-00HaHF-Ko; Sun, 29 Oct 2023 20:40:36 +0000 Date: Sun, 29 Oct 2023 20:40:35 +0000 From: Matthew Wilcox To: Daniel Gomez Cc: "minchan@kernel.org" , "senozhatsky@chromium.org" , "axboe@kernel.dk" , "djwong@kernel.org" , "hughd@google.com" , "akpm@linux-foundation.org" , "mcgrof@kernel.org" , "linux-kernel@vger.kernel.org" , "linux-block@vger.kernel.org" , "linux-xfs@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-mm@kvack.org" , "gost.dev@samsung.com" , Pankaj Raghav Subject: Re: [RFC PATCH 05/11] shmem: account for large order folios Message-ID: References: <20230919135536.2165715-1-da.gomez@samsung.com> <20231028211518.3424020-1-da.gomez@samsung.com> <20231028211518.3424020-6-da.gomez@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231028211518.3424020-6-da.gomez@samsung.com> X-Spam-Status: No, score=-0.8 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 howler.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 (howler.vger.email [0.0.0.0]); Sun, 29 Oct 2023 13:41:06 -0700 (PDT) On Sat, Oct 28, 2023 at 09:15:42PM +0000, Daniel Gomez wrote: > @@ -856,16 +856,16 @@ unsigned long shmem_partial_swap_usage(struct address_space *mapping, > pgoff_t start, pgoff_t end) > { > XA_STATE(xas, &mapping->i_pages, start); > - struct page *page; > + struct folio *folio; > unsigned long swapped = 0; > unsigned long max = end - 1; > > rcu_read_lock(); > - xas_for_each(&xas, page, max) { > - if (xas_retry(&xas, page)) > + xas_for_each(&xas, folio, max) { > + if (xas_retry(&xas, folio)) > continue; > - if (xa_is_value(page)) > - swapped++; > + if (xa_is_value(folio)) > + swapped += folio_nr_pages(folio); ... you can't call folio_nr_pages() if xa_is_value().