From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-174.mta1.migadu.com (out-174.mta1.migadu.com [95.215.58.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ACD0D4C9D for ; Fri, 30 Jan 2026 00:48:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769734108; cv=none; b=SCsAdpRVCxrAksttwNj8tjsgKTznXpbU644n2s7NdzfvouGHVaiCVLrD7+E5M7r/zB/himAXsHERPxhLd+mH/lo3EVh9xzolHigotpJB6aS6WzF2dnlOISsRK6kKtn+L1rzYQ90c1y0KVznh51fUC54sNLaudWumvyKv+BqyvEg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769734108; c=relaxed/simple; bh=yAVC74DfDR/zd4fiVB7+zar9cqE+QxyRqgD3p672vGU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=t5sIsKVhzWZCxGzXL9lJ4CUcEyG3saSBrJ3cqV/xHtrr51NtDx/NWgZERt7BV5SBPe3ItkBM9cZL6jqCO040YpSRgDo/A9n/Zk+s/PE4t/yBMEI88+uO3Ar4TLGNduOAXtZkFCnDpgb2fM5d4BxQNzQj1qo0NPBGqVPpuahOR3U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=NfitKoMr; arc=none smtp.client-ip=95.215.58.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="NfitKoMr" Date: Thu, 29 Jan 2026 16:47:52 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1769734094; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3A7pdALAafDL6kVov9I53Tgt62PET1/OP4Y8CWDvMKY=; b=NfitKoMrfWHJEnK3FhKbb+oShyVAZTBfjwr8XLV9TIyZokJxCNMF4keXeuZcm+Q1s3ZApR e0DX89ObAsutfv9yR9T+itV6cEKczkWp7+oz69T01XjFU4hWx10VmRx2m9MHnEtzVaek3r ZdzYZNot83emT4Xfld8CCUaVEqEFJBo= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: Matthew Wilcox Cc: Andrew Morton , Johannes Weiner , Rik van Riel , Song Liu , Kiryl Shutsemau , Usama Arif , David Hildenbrand , Lorenzo Stoakes , Zi Yan , Baolin Wang , "Liam R . Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Meta kernel team , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: khugepaged: fix NR_FILE_PAGES accounting in collapse_file() Message-ID: References: <20260129184054.910897-1-shakeel.butt@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT On Thu, Jan 29, 2026 at 10:47:16PM +0000, Matthew Wilcox wrote: > On Thu, Jan 29, 2026 at 10:40:54AM -0800, Shakeel Butt wrote: > > Fixes: 99cb0dbd47a1 ("mm,thp: add read-only THP support for (non-shmem) FS") > > Are you sure this is the right Fixes? 99cb0dbd47a1 wasn't cgroup > aware: > > if (nr_none) { > struct zone *zone = page_zone(new_page); > > __mod_node_page_state(zone->zone_pgdat, NR_FILE_PAGES, nr_none); > - __mod_node_page_state(zone->zone_pgdat, NR_SHMEM, nr_none); > + if (is_shmem) > + __mod_node_page_state(zone->zone_pgdat, > + NR_SHMEM, nr_none); > } > > b8eddff8886b added cgroup support: > > if (is_shmem) > - __inc_node_page_state(new_page, NR_SHMEM_THPS); > + __inc_lruvec_page_state(new_page, NR_SHMEM_THPS); > else { > - __inc_node_page_state(new_page, NR_FILE_THPS); > + __inc_lruvec_page_state(new_page, NR_FILE_THPS); > filemap_nr_thps_inc(mapping); > } > > which would seem like the right Fixes: to me? > b8eddff8886b is about different stats NR_SHMEM_THPS & NR_FILE_THPS. However as Johannes responded this code was broken even before memcg awareness for NR_FILE_PAGES and NR_SHMEM. I will send v2 with correct handling of NR_SHMEM as well.