From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-179.mta0.migadu.com (out-179.mta0.migadu.com [91.218.175.179]) (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 680FD30E85E for ; Fri, 30 Jan 2026 00:51:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769734268; cv=none; b=NfnNLdDV3o3bBjOGDKlz3EwfIeDADuMs3pDTCtiNETuo0iIVzpwA6uhYdFS74rBJzQVaY0eJ4mnZ5TxAYK6MeQQjebMaDHL5tF+PJMFNuMavKL4mfcZG50qknm5qVgPStxIpeSDNWEdeYU4yREswTLuyn58a7ywQIE2dL42f3qM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769734268; c=relaxed/simple; bh=6YUrVNS2AcKSw9HSyU5YL7g03O3wVPFbJE99k3TJ5BE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=doZKFIwD3CAKOI5KdY3L4hAgP7GJKdulCDVthDTk6+XACaRBbvIm10Xu8wIGtAH6bJAtbIypTawsWDkUW/karcdkLuWJKFGX26fkmuoW722l1gb3/OAdWzmcdkthjJEr+rVylQb3h5jZu57KYCn+lnhIdFM3x0C/1tUDF9bO14o= 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=Z/FaQ/kg; arc=none smtp.client-ip=91.218.175.179 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="Z/FaQ/kg" Date: Thu, 29 Jan 2026 16:50:57 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1769734262; 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=3beR78siDEEmK2spAD/HgnCu/E4OotAxU6+k9E99kQg=; b=Z/FaQ/kgxOCkIdV9pj9isA31VgQFflC/MoNR38FryrcwIrK5Mas3RvcmCHNpwvvJWp4BSU u1jPf1N0mdSlIcRcEclZA5y4KSScu2Y3nwpAt87BQPqOY1spg5dQd3LjSS2HtQs5A6NZsX JDGHWhKyhKG9PMhWjxlqmTcvcshg0Ig= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: Johannes Weiner Cc: Andrew Morton , 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: cgroups@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 07:32:14PM -0500, Johannes Weiner wrote: > On Thu, Jan 29, 2026 at 10:40:54AM -0800, Shakeel Butt wrote: > > @@ -2200,8 +2200,8 @@ static enum scan_result collapse_file(struct mm_struct *mm, unsigned long addr, > > else > > lruvec_stat_mod_folio(new_folio, NR_FILE_THPS, HPAGE_PMD_NR); > > > > + lruvec_stat_mod_folio(new_folio, NR_FILE_PAGES, HPAGE_PMD_NR); > > The memcg breakage is more visible, but I think this has been broken > for NUMA stats even longer. new_folio could also come from a different > node than the subpages, after all. Indeed you are right, so I should blame Kiryl instead of Song :P > > > if (nr_none) { > > - lruvec_stat_mod_folio(new_folio, NR_FILE_PAGES, nr_none); > > /* nr_none is always 0 for non-shmem. */ > > lruvec_stat_mod_folio(new_folio, NR_SHMEM, nr_none); > > So AFAICT NR_SHMEM needs the same treatment. > > It looks like that's been broken since f3f0e1d2150b ("khugepaged: add > support of collapse for tmpfs/shmem pages"). Thanks, I will send v2 with correct handling of NR_SHMEM as well.