Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2864022rwr; Fri, 21 Apr 2023 15:51:43 -0700 (PDT) X-Google-Smtp-Source: AKy350bDhr6VgiGtGSmDkNemItLUe2gcYepcSDfACGa3qa4PXPQI/AC28yKdUVthCy0AKHR4thhP X-Received: by 2002:a05:6a20:8e19:b0:d7:3c1a:6c9a with SMTP id y25-20020a056a208e1900b000d73c1a6c9amr7431537pzj.4.1682117503424; Fri, 21 Apr 2023 15:51:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682117503; cv=none; d=google.com; s=arc-20160816; b=JsLPJFXp1jZZRWS+26VpGjov1DiZeetBSkqDJbBlbR7YS9FyUlLXn6/sO3wKq0hul5 2gVG0Q+I20g401Rg9IEEet6NxKaZRzu282/jG8wI9EmrCP0mquSsvyeD5hQ2D9xWHsAN q3BO8l8MXdGsDr0Lo80MeT+8iDXJ99zK62Bq8XmTL+2155p+RmhDO0tpM57obcbxxDfd Tgw4G6aIctTDcY42eR00vh3S6BqbuLCDH6S6pY1m4sZkNABBz72QwPiErBCfe3elnmd4 BFITIHOZZnihnOBh7eHAl1cgFMsf4GaZJcU9Wv5iO+16nZy62VtragLILXZ4STbQctsA 0aMg== 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=VcM5hqe8ohQj2y6ERa1ukw3ufFJS21Hh1hq4I+TYzSo=; b=shV1rr8sTv1Un2kakYjJ/JhKmk+FiRk7nyJWrvvgq3esbswRzsLyEZobZPSmC1FVdV p4Ppi4wq4kynVztij4Oz9tslBs1/brcKljBVkDz2kKp5+PksQDdkvkD0vRrrFc9r3FMR LmJbQgvbvNgXQvCE14TGmM42eIs59JCDrE54It+FV4pFIF2FbdS0Pz+essBVahZY2rrv wDne5IitTCNeQQ+hfiNlRcAldrwRW3u5CxYh+WmFgC4iDMhLB57kSmknOfzwAAxrV5SH BmRxuHxJfYja3lIG4PdLWyaGrhFtEhQqJDB7awYJpcJqtRciBcU7yaBcGu9BBFwJFFky f5vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=rgNlBrbB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w68-20020a626247000000b0063b87f60f7bsi5361667pfb.48.2023.04.21.15.51.30; Fri, 21 Apr 2023 15:51:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=rgNlBrbB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233952AbjDUWrM (ORCPT + 99 others); Fri, 21 Apr 2023 18:47:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233765AbjDUWrK (ORCPT ); Fri, 21 Apr 2023 18:47:10 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED6C91FF1; Fri, 21 Apr 2023 15:47:08 -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=VcM5hqe8ohQj2y6ERa1ukw3ufFJS21Hh1hq4I+TYzSo=; b=rgNlBrbBZQE/jPeLix+D0ilI0Q 71kmRlZ2+T7aKhtBX4TmXZ0BiGQZ6bWSHN2OzBeUMgbJLMrI7CQn70w0LvkZZGKGUJujkqTXWkWCn Uh6eKQlha9lwPIMZE0f1gWoEFMdo8DN/1Pxf71MEA3Z2VCdB/1uMtYEpQ0H1m50J90mZqXPHNOXGx bSzD0JUSBjwZItHuHF9/l21almvKizFj2XpMdsw1wY4wRNpKrGeRSwNNW62/pJmU8cPHf8nq6R41+ wt8Sfq2bTDEup+WZg0StBdVV64q8kbX2jTs0APsYWtyNZY/6fadEMw2ddReaCFvGP6+6ykleJrobe Sok4SDkw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1ppzWs-00FiFo-Cm; Fri, 21 Apr 2023 22:46:58 +0000 Date: Fri, 21 Apr 2023 23:46:58 +0100 From: Matthew Wilcox To: Luis Chamberlain Cc: hughd@google.com, akpm@linux-foundation.org, brauner@kernel.org, djwong@kernel.org, p.raghav@samsung.com, da.gomez@samsung.com, a.manzanares@samsung.com, dave@stgolabs.net, yosryahmed@google.com, keescook@chromium.org, hare@suse.de, kbusch@kernel.org, patches@lists.linux.dev, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RFC 3/8] shmem: account for high order folios Message-ID: References: <20230421214400.2836131-1-mcgrof@kernel.org> <20230421214400.2836131-4-mcgrof@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230421214400.2836131-4-mcgrof@kernel.org> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 21, 2023 at 02:43:55PM -0700, Luis Chamberlain wrote: > - if (xa_is_value(page)) > - swapped++; > + if (xa_is_value(folio)) > + swapped+=(folio_nr_pages(folio)); swapped += folio_nr_pages(folio); > if (xa_is_value(folio)) { > + long swaps_freed = 0; > if (unfalloc) > continue; > - nr_swaps_freed += !shmem_free_swap(mapping, > - indices[i], folio); > + swaps_freed = folio_nr_pages(folio); Why initialise it to 0 when you're about to set it to folio_nr_pages()? > + if (!shmem_free_swap(mapping, indices[i], folio)) { > + if (swaps_freed > 1) > + pr_warn("swaps freed > 1 -- %lu\n", swaps_freed); Debug code that escaped into this patch? > - info->swapped++; > + info->swapped+=folio_nr_pages(folio); Same comment as earlier. > - info->alloced--; > - info->swapped--; > + info->alloced-=num_swap_pages; > + info->swapped-=num_swap_pages; Spacing > - info->swapped--; > + info->swapped-= folio_nr_pages(folio); Spacing.