Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4629770rdb; Fri, 15 Sep 2023 07:53:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH4ECFDaa42L8qVS9LA4G2ZBQAZXbYZfMJmKT/tZrlpJPcHUe1dvIUQ0Y9WEIR+xXqxYDSi X-Received: by 2002:a17:902:ec81:b0:1c3:6d97:e89e with SMTP id x1-20020a170902ec8100b001c36d97e89emr2093510plg.58.1694789623584; Fri, 15 Sep 2023 07:53:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694789623; cv=none; d=google.com; s=arc-20160816; b=D56gcUYwLC2n62i8+YeedyNPSdzIYMQDCZ8t8wipDaBNdmw9MWi2ovfmVEIcoS4CU7 hM0JxdDcuqwC0Srq8kX2NOOvv3Q2l4GO8siRkdKv+dVs2gR6E3uQhpBFYIlGqAz0Z6Ko PU9ntWf1ZLSSt5O9L7MhHZ1pbCP0G3zay3+Q9fREFvhFojeOCegoa5IAyq9s712PJq+6 FwNlynlze6n7fHzpndGV4ER9XXVZUrZmdId/KX+HxhQ4Lu93HQ4kpJC98pmhFv94PlMp TiF7yXx0xMwbUYyV5CdmTrp0v3EVg0PYLZVIDqluYF9dqahF5x6rzpo1FkYAZ1hdwVre t7Uw== 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=9cnxnW7ESMZ0JG3goy/SixkPNAd8GwuVMtcmWWhCh8M=; fh=ardmABoZqyzAm25ow9fvqe18o8v8L1P0+Wo2I9sPHpg=; b=WfJz+W+7JbkvcanExccZxPRsCYoxjoC7V1ob3TQXLCY9m96EAqr9Qh/wOKx9IrF9Eu 37HO2GOt1WrSrAThe/S+sV0Uc3YzN1Aacna5oCwIwufj8n1SxWpPj88Vr4PWOSKUQWUU DKikm4s1Ia9i1g4cQxaRysh764IH60kX+7BZ73HpONvQXrDDeuZoHmueSzf8NlCck//n SqGXqXu8ntqgOzdRFXygJ3m9mWVN/Y3otfMT6zh6N4JNbkiclopoP8RsCVK35oqOTl8G 6FtaG6g4uqMJR6hbSXCgE5wD7t6lcZ2HB+/1HCin+39PWdQXQxyBZ7WYZEF84JI5Ky1o +k1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=hh6qr8cf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id u4-20020a170902b28400b001bb29476f47si3465214plr.503.2023.09.15.07.53.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 07:53:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=hh6qr8cf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 9900280725CB; Fri, 15 Sep 2023 05:15:25 -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 S234664AbjIOMPR (ORCPT + 99 others); Fri, 15 Sep 2023 08:15:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234647AbjIOMPP (ORCPT ); Fri, 15 Sep 2023 08:15:15 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C93192113; Fri, 15 Sep 2023 05:15:09 -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=9cnxnW7ESMZ0JG3goy/SixkPNAd8GwuVMtcmWWhCh8M=; b=hh6qr8cfEsfSY8d709qeQzGUkh UqWbKETiUA6IhftO6ApR9FkEpzteHmM+8ekxGG4ssTV4swSkqsb1TXp7TEXFZmosyzLUBBOxCxCrV lUG8Crmn4dfj7jxugqd8oCM8Q/6igBT/i9H9+7IY7mFu9sfs0InzwaJ8D82+W1GJtsjHT1LAMul5E lGrj/xb0Tk2yDdB26P2rvy6GpP88l0V3thIIOSknLo2fVBpglW/ONxUboUlhJ4vZEzqDRpK53DDT/ f4aWb4/Nm9XHkK57VOp7Rr4oRjRAmnJWS0/bZp2jyLt65GoP4gBWCbe9R83/9KVSRXryzj9mZRKd3 wJ9rqGzA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qh7iq-009cFS-1s; Fri, 15 Sep 2023 12:14:56 +0000 Date: Fri, 15 Sep 2023 13:14:55 +0100 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: [PATCH 3/6] shmem: account for large order folios Message-ID: References: <20230915095042.1320180-1-da.gomez@samsung.com> <20230915095042.1320180-4-da.gomez@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230915095042.1320180-4-da.gomez@samsung.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 05:15:25 -0700 (PDT) On Fri, Sep 15, 2023 at 09:51:26AM +0000, Daniel Gomez wrote: > @@ -1810,13 +1815,14 @@ static void shmem_set_folio_swapin_error(struct inode *inode, pgoff_t index, > return; > > folio_wait_writeback(folio); > + num_swap_pages = folio_nr_pages(folio); > delete_from_swap_cache(folio); > /* > * Don't treat swapin error folio as alloced. Otherwise inode->i_blocks > * won't be 0 when inode is released and thus trigger WARN_ON(i_blocks) > * in shmem_evict_inode(). > */ > - shmem_recalc_inode(inode, -1, -1); > + shmem_recalc_inode(inode, num_swap_pages, num_swap_pages); Shouldn't that be -num_swap_pages? > swap_free(swap); > } > > @@ -1903,7 +1909,7 @@ static int shmem_swapin_folio(struct inode *inode, pgoff_t index, > if (error) > goto failed; > > - shmem_recalc_inode(inode, 0, -1); > + shmem_recalc_inode(inode, 0, folio_nr_pages(folio)); > > if (sgp == SGP_WRITE) > folio_mark_accessed(folio); Also here.