Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2336819rdf; Mon, 6 Nov 2023 11:00:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IH5glLuKMcZ6JVD+6hQFr13+gtqYf3G53ODqANnu95JHu9RMkB1qsnjcLgF0JhkJfB//zHp X-Received: by 2002:a05:6870:af03:b0:1e9:d261:cc84 with SMTP id ux3-20020a056870af0300b001e9d261cc84mr583468oab.19.1699297255854; Mon, 06 Nov 2023 11:00:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699297255; cv=none; d=google.com; s=arc-20160816; b=dVCGSTmxdUasDUUwY7E2hMTq3K+hhPWr0EgpHE50LbWo6H8zLmjrZotxwCmOJw+kqw cUj16Jel+T9tvuiQ86Pgah73mO0sr+N+IjkfXq19HO3Gy+BzUSw+UnK9aDlCpf0C48YO FZvnquMs3tDip2wa98c4I30RkROAF6bMUimnCj5TOkg0guj6j85pkA5BqAM5K8XxRbB/ 1gSb5qio7YCpUvN2GlHEIIUWhpByI4A9Y64IkXMW2x7esd1KA51PkCLXk6CvMNVpCI/V yoQRcbVLoDXo9t8Fi6vjZ4uDR+CDlFy/B5k7gniS2k2NRlEKxVigtLJyiNN3XVNv/Bi/ iP6w== 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=S1v0S2JecaFdDuKteJQPQfqSbMeszz0DlIV0jVMrBEs=; fh=uVphG/u6AXWmiiwOJjDnTDT47Q5oiIGLgHK9lGiAhu8=; b=0+UJiVtpxIVkN73pQ3izHh2oluWFM0XcEHOODBBtURvsd1s6W346/GTSuHb+qpApNv 8/jE2btSbWB+q9rIVXmy9J19pW22XaL4igRIYvdwlIulVHq8daXauQD689bm888xunpd qahEFZ3ilZjPBfJEOCqAxb9bvaojUuGs8xezdTaO7pzlTbzVXuecEQTwHKsnAC/tqXYf V0BXr8HcwGVo/D0IFsUdOnRW1sejLFGS3aaJbXlwHogNO2gjf3hiCszkyZ284Cwmrwq/ xU+X92eVvkHy7cTrzBXeDv3WitFLkd7FI7cvEgGSFf2qO84xWncdRNWkyuiPelovwSnO CNAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=iAUlm6oE; 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 b13-20020a056870470d00b001d6cec340f2si2442739oaq.251.2023.11.06.11.00.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 11:00:55 -0800 (PST) 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=iAUlm6oE; 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 F119C8077A52; Mon, 6 Nov 2023 11:00:52 -0800 (PST) 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 S232755AbjKFTA0 (ORCPT + 99 others); Mon, 6 Nov 2023 14:00:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232547AbjKFTAY (ORCPT ); Mon, 6 Nov 2023 14:00:24 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7017E134 for ; Mon, 6 Nov 2023 11:00:20 -0800 (PST) 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=S1v0S2JecaFdDuKteJQPQfqSbMeszz0DlIV0jVMrBEs=; b=iAUlm6oERK7x44Sld/Wg5L+uUl NdFtvZIpve6t49PqXASj+HLAVbCkH/1V8oiMJXxmIgF5UaY4JmhLiROqZjH/wI8gT2Hkyinonpvhg SV1bFvn0KNo1lBi2heNS96mlIP+1LbsNWMkpOMk1MmQg4+IHpvfw6m3Wlvf5xU8T0upPE5CQtDhXw xSx038MlfmTDx0KLeioKVvgBdXIk/AF7T81tg+L7j8GSE1Lo+g3aiLn13n96ykvPPIx/OjQVZgG54 9BPCoY9SIoeM3pZskimmZtEqsenTTz+QFkzpddqwc5CbZ4zycHoOydwxMcKMAIjcy9N3ZrtSqzenT Zs7yNhlg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1r04pH-007dUy-GT; Mon, 06 Nov 2023 18:59:55 +0000 Date: Mon, 6 Nov 2023 18:59:55 +0000 From: Matthew Wilcox To: Stefan Roesch Cc: kernel-team@fb.com, akpm@linux-foundation.org, hannes@cmpxchg.org, riel@surriel.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v1] mm: Fix for negative counter: nr_file_hugepages Message-ID: References: <20231106181918.1091043-1-shr@devkernel.io> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231106181918.1091043-1-shr@devkernel.io> 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,T_SCC_BODY_TEXT_LINE 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]); Mon, 06 Nov 2023 11:00:53 -0800 (PST) On Mon, Nov 06, 2023 at 10:19:18AM -0800, Stefan Roesch wrote: > +++ b/mm/huge_memory.c > @@ -2740,7 +2740,8 @@ int split_huge_page_to_list(struct page *page, struct list_head *list) > if (folio_test_swapbacked(folio)) { > __lruvec_stat_mod_folio(folio, NR_SHMEM_THPS, > -nr); > - } else { > + } else if (folio_test_pmd_mappable(folio)) { > + > __lruvec_stat_mod_folio(folio, NR_FILE_THPS, > -nr); > filemap_nr_thps_dec(mapping); Good catch. Two things: 1. No blank line after the 'else if'. 2. We're leaving a bit of a landmine for shmem when it gets support for arbitrary folio sizes. Really all of this should be under a test_pmd_mappable.