From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 63ADF288C22; Wed, 28 Jan 2026 15:54:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769615663; cv=none; b=bPKUUvCXnc7Pl2Ao77h0sUB86cGLsnCyoLXSUfd9XyUFGoM2N/BB0WEfmQBBrJEkqqHko8MsIGwBh2BzGFkWv2w7mLdxLTXYagZaSByWpoqPI6g987i5/g/bFEsSB3aeBhfCTbT61tKcYm+mT2dG8vSrNFGJ7S0cCfBZsk3vCLs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769615663; c=relaxed/simple; bh=W3nIZ0/UTWNZpMYqmUtkrDjGOXfHlZAiIn5/pVdAaQ0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZfGJfzb8Ds3WwAD0y8BNHN9hinmcExQYGmudr/MRif4KkkwovY2zFv2Ve3f6U0JVxFXicRKr6wxJsk+9gNbvHWoCujSUD1vXi4hNw1tdNDUDhXcB/kQXtyg/YFVTfBp/e1ZhGDvR08aBB/Fw9ERL0pqs7r4OkfLMy7ZjupLK8XQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=BrQxsIDo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="BrQxsIDo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B944C4CEF1; Wed, 28 Jan 2026 15:54:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1769615663; bh=W3nIZ0/UTWNZpMYqmUtkrDjGOXfHlZAiIn5/pVdAaQ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BrQxsIDo3SJPYV3OxRQT07kWYIARv+YnafU36ZnmeMV8TH6Ey1ShaCmCjItv5Yfqn RKpSY33y8t4Ro/TtenIS46953/L2W8/7OSyhVO31Qt9McNKAPjhDfqFNmKXPwmrcgF ZOZBt7d6xHAqefA+Do35rGbVlLDWM9PjGBmKkWYU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "David Hildenbrand (Red Hat)" , Rik van Riel , Laurence Oberman , Lorenzo Stoakes , Oscar Salvador , Liu Shixin , Harry Yoo , Lance Yang , "Uschakow, Stanislav" , Andrew Morton Subject: [PATCH 6.18 077/227] mm/rmap: fix two comments related to huge_pmd_unshare() Date: Wed, 28 Jan 2026 16:22:02 +0100 Message-ID: <20260128145347.113772013@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260128145344.331957407@linuxfoundation.org> References: <20260128145344.331957407@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: David Hildenbrand (Red Hat) commit a8682d500f691b6dfaa16ae1502d990aeb86e8be upstream. PMD page table unsharing no longer touches the refcount of a PMD page table. Also, it is not about dropping the refcount of a "PMD page" but the "PMD page table". Let's just simplify by saying that the PMD page table was unmapped, consequently also unmapping the folio that was mapped into this page. This code should be deduplicated in the future. Link: https://lkml.kernel.org/r/20251223214037.580860-4-david@kernel.org Fixes: 59d9094df3d7 ("mm: hugetlb: independent PMD page table shared count") Signed-off-by: David Hildenbrand (Red Hat) Reviewed-by: Rik van Riel Tested-by: Laurence Oberman Reviewed-by: Lorenzo Stoakes Acked-by: Oscar Salvador Cc: Liu Shixin Cc: Harry Yoo Cc: Lance Yang Cc: "Uschakow, Stanislav" Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/rmap.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) --- a/mm/rmap.c +++ b/mm/rmap.c @@ -2027,14 +2027,8 @@ static bool try_to_unmap_one(struct foli flush_tlb_range(vma, range.start, range.end); /* - * The ref count of the PMD page was - * dropped which is part of the way map - * counting is done for shared PMDs. - * Return 'true' here. When there is - * no other sharing, huge_pmd_unshare - * returns false and we will unmap the - * actual page and drop map count - * to zero. + * The PMD table was unmapped, + * consequently unmapping the folio. */ goto walk_done; } @@ -2416,14 +2410,8 @@ static bool try_to_migrate_one(struct fo range.start, range.end); /* - * The ref count of the PMD page was - * dropped which is part of the way map - * counting is done for shared PMDs. - * Return 'true' here. When there is - * no other sharing, huge_pmd_unshare - * returns false and we will unmap the - * actual page and drop map count - * to zero. + * The PMD table was unmapped, + * consequently unmapping the folio. */ page_vma_mapped_walk_done(&pvmw); break;