From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-188.mta1.migadu.com (out-188.mta1.migadu.com [95.215.58.188]) (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 6F57C2309B2 for ; Tue, 26 May 2026 12:56:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779800188; cv=none; b=fZ08IG+AajjF8JaxDZfrd6HiI7GRfCsMMu7IMyq59uFC7gcbAfcKjXY9rYEuH1neGHdZMgA1gXvIVNjXdKH8+9FOFGazjDnIEV0WSnnX/thutV+kyz+8pBfCKTvqgxQwxAk3yH/1uhfjyakqFq6oa/0chRcilmaeO2OVM4pcvSs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779800188; c=relaxed/simple; bh=JU7eq6I2jPDxDfe2T5IMnm9RAHvvxOtoBUIkCy5w30Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=DWUPAKbfRELTashrdg1jrG9eyR1JkNhWTxvESKWmiN8ArB4TIwtA6Dg16ve/Q3LO9pL9dd4m1YsGlNH6c4S5/NM2h3xTa+26Dq0t+7Z+FnbkDHTU/CYTjm0Uu9LCK4lJFz6ejmQ0+HOfDlug0nZhSdB22zyvV0hxpCrUcNTDzj0= 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=xnnaurTS; arc=none smtp.client-ip=95.215.58.188 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="xnnaurTS" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1779800185; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JU7eq6I2jPDxDfe2T5IMnm9RAHvvxOtoBUIkCy5w30Q=; b=xnnaurTSzTJdSa9ximYjZKUGfBzMu7x5E4F8xHgkpgw3dHa/cX/0fuMStpiTt/KQF8aHlp TkFu/1Jsv+559dKjTrbn8MvXHO3OXjtXwJlkGiCVgZFNZGkCMGihP5MYjhCYZquLdsjAFx EOoMl6/aP7XO3g1OCgH+NqURHp+4Oio= From: Lance Yang To: yintirui@huawei.com Cc: akpm@linux-foundation.org, david@kernel.org, ljs@kernel.org, ziy@nvidia.com, baolin.wang@linux.alibaba.com, liam@infradead.org, npache@redhat.com, ryan.roberts@arm.com, dev.jain@arm.com, baohua@kernel.org, lance.yang@linux.dev, vbabka@kernel.org, yang.shi@linux.alibaba.com, wangkefeng.wang@huawei.com, chenjun102@huawei.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] mm/huge_memory: update file PMD counter before folio_put() Date: Tue, 26 May 2026 20:56:08 +0800 Message-Id: <20260526125608.60396-1-lance.yang@linux.dev> In-Reply-To: <20260526101337.1984081-1-yintirui@huawei.com> References: <20260526101337.1984081-1-yintirui@huawei.com> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On Tue, May 26, 2026 at 06:13:37PM +0800, Yin Tirui wrote: >__split_huge_pmd_locked() updates the file/shmem RSS counter after >dropping the PMD mapping's folio reference. If folio_put() drops the >last reference, mm_counter_file() can later read freed folio state via >folio_test_swapbacked(). > >Move the counter update before folio_put(). > >Fixes: fadae2953072 ("thp: use mm_file_counter to determine update which rss counter") >Cc: >Signed-off-by: Yin Tirui >--- Thanks! Feel free to add: Reviewed-by: Lance Yang