From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-178.mta0.migadu.com (out-178.mta0.migadu.com [91.218.175.178]) (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 48397223702 for ; Tue, 26 May 2026 12:54:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779800057; cv=none; b=BbJ/vqV1vferN6a/b9GRt+jrnBWyMit58igORTuCxWJwnVLsbazWWVd6i8XDShVOsWgYcfZ+EZ2GtHHTNkmHLNITXHXZUmi4nHGikh+LvOnI5JHgwdNXW26hIBq0NHFN9nThU0UtW9ZbJwZRbE0I//D9C4zExjlO13Qdel80bxo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779800057; c=relaxed/simple; bh=8NFmtjNVk6yqSf59PQPhoTYEdjcxCUFRSGiq2LjpJPU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=SOhF36ATcMaFfzF4SHe8mWWuIBW434VRO/8ba94dZLaG7Ngy0kHpK8SFMvHu8lIqCzYpGYGUiGXpCtxsYBEFnyRWjdJyqTvXMxgWDD2ow2BuaOJSzca6inso6pS/J5fLmQ1w3Ap/30rpSZ1/HswAv1nrK4rPs5F8MfURYgp0kbo= 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=EKucJNjP; arc=none smtp.client-ip=91.218.175.178 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="EKucJNjP" 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=1779800044; 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=8NFmtjNVk6yqSf59PQPhoTYEdjcxCUFRSGiq2LjpJPU=; b=EKucJNjPDOyhy/Ct1wzGkugYgHG38e4JHfUiB89+kwZuDSasTGZUEoc1YDrz5Tlx3cQgBS nbFBvy3MoCeQXc3AEh1D5EiRZA7JxcqK8wuhQb/KM8RElSncECRexNGouS6+eizOvOXxUG BRDHXzkKV0rGmVw5LE4kz+EpbfTed0o= 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, djbw@kernel.org, apopple@nvidia.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 PUD counter before folio_put() Date: Tue, 26 May 2026 20:53:51 +0800 Message-Id: <20260526125351.58831-1-lance.yang@linux.dev> In-Reply-To: <20260526101355.1984244-1-yintirui@huawei.com> References: <20260526101355.1984244-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:55PM +0800, Yin Tirui wrote: >__split_huge_pud_locked() updates the file/shmem RSS counter after >dropping the PUD 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: dbe54153296d ("mm/huge_memory: add vmf_insert_folio_pud()") >Cc: >Signed-off-by: Yin Tirui >--- Thanks! Feel free to add: Reviewed-by: Lance Yang