From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.47 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796383901; b=te2pNq+Qrs9fvGyWyNk9rqMU/PDPkC5dLzMAku1LO9KF5sBDxXaruydJUmEpdko6yan9 SWQ1zaoS2BW70uX2145+/qsczl6RK7xn7mt6VMpB023VBNjF05xDBXBePC9lVoZPPrurx cpuFbSEypI+PjuMcTR7oj4xK8qU6JWmUxeieutxBX904xhyKD3hdpW4RAjtieUyBQ+n9P TbrXegE/YTHthG6A11dLJUY5d93LgCiM3C23oMf9iJB/UoimflYdlHAjzbGxAoUwV3kf3 /5KpVpYFo9yKAZUWbcjrQmZPPnozeGubCsxJSnCsM4HxVtsOAdS01BoU8rqM2rA7p8g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383901; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References: Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=Lk6hlCDkLZzPkkijHQnk6Qw+vjvdmIDcakQOULDVJNs=; b=T1WzyZTt38iyhbJAGtT4LiKt0AebNFxfT9arZ31l3dpNQxEwvWBJgA5zQ0WGinZupWIX q/PkKgsZNhUNLwQCz8fW+7Zq7YxjEmO5/cST1qfW/TxjbPf2ef25QGJmtQWV51+gvdcgM SrTmfVX7GgX6Ms27foLGZ6mzRk/3xE1IIHgZWlPzqo3+50tfUO/ERGj6uNrB31T70wm4M sanp6/Mr7m2eIEDQ2rSaY2/wsz+m87JqkIXZTvCpHGffyfSWuIKFF+1qf6JGWn6y/mDAc 4TI0tsVvNrM526n2P+px8fQ4z0BxOmASCtjeH/vJJuFdSa8RaIJIxbjG74dsZePVlQg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=PO+jhsfQ; arc=none smtp.remote-ip=209.85.128.47 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B502260A380C for ; Fri, 4 Dec 2026 11:31:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B502260A380C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=PO+jhsfQ Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4a207b02a2cso6327285e9.1 for ; Fri, 04 Dec 2026 03:31:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796383899; x=1796988699; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Lk6hlCDkLZzPkkijHQnk6Qw+vjvdmIDcakQOULDVJNs=; b=PO+jhsfQYpvD3YXLsdkcBa2yuHQxvcDklx0NEqIN/sHxcvXfgiK2PXswLTt5SBbpIL sWO5Ms/y1gCoZdq2PBn0zmnvHsUq7rV8ci+aAoOfHM2JJRzcfp8DtpqW9dQZXjsTGNDe FL30LxnQUUoskGb0hsAX+rqGGN2gbdRKH5o3+Let2kpUJXw3nsNaiD6IM96VyjDc2wwj wXlSe7xsQx7+OdMaVYOslwl3E4iDToFzn7Oa572iHicgR+tpR8hBYXGOI6w1ueoKLiW+ X+E1stAgMW+ZfFO5wd1pUHlQ2XoDl1TJiCBy2Fb5vF+mgxoZIdYIeeM6RCP1+4vZdO8X HUfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796383899; x=1796988699; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Lk6hlCDkLZzPkkijHQnk6Qw+vjvdmIDcakQOULDVJNs=; b=eFE1AZ5S0/m6iEqDQxeInbMj6C4MwLifdNaVilfdvDZXgVzNs7vCM3V0gJXt6mMTWe TjFAExQ1TPpf4kXf6+VkWEquXqz0ouuquxNsdKfY7bgE3amJk7GwdpVMmTwDc5Bp7yFS iJ5WS0pwgYE9D4ipYe/mrizdaTDrxIvQIUrcKCBK7XrtL0t5e8FEVvwYa44v4gXsqUlW CmtqAhM9INTzydPWRunm9N8oPZFNyk5D+wXOPd6b7fCBsM1VUdC7JNTMYWvAiDxXhlrI +IF210pLMn4Cq9wXEBts5DxWj/ZC2CKBe7sjaYLNXwr6s4+bvKAwf+4VvqSEon4CkbU8 UXaA== X-Forwarded-Encrypted: i=1; AL+hErHf5HEgGOUQta23jpfh6WR7j22aoZwzwA87t2/JhF7JMH/VUtqHK8Fp/H8RFpx7PtaKwsDO5Qg=@vger.kernel.org X-Gm-Message-State: APuU4Z8JGFT+BuXUp/22WdDQmWQII/np+lSxgqChSXNtKRe4VNrhk9kq tMCVb66X69oQyqL5MQ5cLwOPie7Atqg8nwpHVDf5BUVThprUMrlXhv63 X-Gm-Gg: AZFdTZfXy54xvqihVOqrGkZ6xZt5mh0PdMFrfAh5kRy82cXeHxJmvqGyVHRLraJZw6m gESZjJ2NXYNgt+vUFO60tS/avBY6eOYEoTM/+WuziNsX74r6AF0R9hUbtfhSyJeJYuFDUfpCZdz LfA+qoNUr0WHNsEX/qCr5QppFHvCkMf0jfLq6tuhkTUKN00jgP5taAAIRrMMJsMGjgkIOZUuh7U dPCu8KlVEdYXKrqu5pJAT4aziiP5GQqVaPBLQjoEZ23aZSZa49BYisYPFzCLldpGRON0BIWVQtc pOHfzI5UGh2X/7mEihHjPdw3Kdxv2KI8Gt9QYLzVoSjjQiPdeTXhEa/KRgE83dVYSlZW/ZSC5Jc mCLrm//WsnJyPNmcIgEo+z1FaKNpBS88FuYjGF/IIcGC8bA1BZsNHd2sAFDXtrrlVvb4Bfi3qhI Ygv9NtJKmgiWb7e2AWR35rrwh9OQnZo2XN4miHyS22jCCLOHi0lbB3P3tsZTPCCE+cFGu9cTQIy vTY5IiF6siM0/SgcACxS8I/qWKZD23K6L2EQllUAb997JED0xSwrO2LaEy+9Cwckt2k4/N1akHJ xkK1E6bWD7xynLXHojS1ekyLpaKg3EHxrt+S2+VGN1ECPkTpCowCdt0= X-Received: by 2002:a05:600c:3510:b0:4a4:fc8c:cfd9 with SMTP id 5b1f17b1804b1-4bbeb8e0e88mr30752485e9.25.1796383899028; Fri, 04 Dec 2026 03:31:39 -0800 (PST) Received: from [192.168.1.22] ([83.231.69.9]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbe00a2f98sm160240815e9.9.2026.12.04.03.31.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Dec 2026 03:31:38 -0800 (PST) Message-ID: <38adf826-32aa-4313-89c8-8f5ddeab9918@gmail.com> Date: Fri, 4 Dec 2026 12:31:35 +0100 X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 26/35] mm/rmap: don't fail unmapping hugetlb folios from private VMAs To: "David Hildenbrand (Arm)" , Muchun Song , Oscar Salvador , Andrew Morton , Hongfu Li , Jinmeng Zhou , Mina Almasry , Davidlohr Bueso , Naoya Horiguchi , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Michal Hocko , Jonathan Corbet , Shuah Khan , Randy Dunlap , Vivek Kasireddy , Mel Gorman , Hugh Dickins , Baolin Wang , Dave Airlie , Jason Gunthorpe , Andy Whitcroft , Roman Gushchin , Barry Song , Andrea Arcangeli , Lorenzo Stoakes , Suren Baghdasaryan , Shakeel Butt , Pedro Falcato , Jann Horn , Guillaume Morin , Yang Shi , James Houghton , Rik van Riel , Harry Yoo , Lance Yang , Axel Rasmussen , Peter Xu , Sasha Levin , Kiryl Shutsemau , Christian Brauner , "Steven Rostedt (Google)" , Hongbo Li , Gregory Price , Zi Yan , Joshua Hahn , Rakie Kim , Ying Huang , Matthew Brost , Byungchul Park , Alistair Popple , Andi Kleen , David Rientjes , Joern Engel , "Aneesh Kumar K.V" Cc: linux-mm@kvack.org, linux-doc@vger.kernel.org, Gerd Hoffmann , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Johannes Weiner , Chris Mason , Jiaqi Yan , stable@vger.kernel.org References: <20261203-hugetlb_fixes_2-v2-0-9bbeabb555d2@kernel.org> <20261203-hugetlb_fixes_2-v2-26-9bbeabb555d2@kernel.org> Content-Language: en-US From: "Jose A. Perez de Azpillaga" In-Reply-To: <20261203-hugetlb_fixes_2-v2-26-9bbeabb555d2@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 12/3/26 12:37 PM, David Hildenbrand (Arm) wrote: > Before unmapping a hugetlb page cache folio, try_to_migrate_one() and > try_to_unmap_poisoned_hugetlb_one() try to unshare the PMD table, which > requires the hugetlb VMA lock in write mode. > > As we already hold the i_mmap_rwsem, we can only trylock it, and give up > if that fails. > > Since private hugetlb VMAs have a VMA lock as well, the trylock can also > fail on private VMAs, for example while another thread is faulting in > that VMA. PMD table sharing does not apply in private VMAs, so there is > nothing to unshare and we fail for no reason: migration fails more > often, and memory failure might leave a poisoned folio mapped. > > Let's fix it by only taking the VMA lock and trying to unshare if PMD > tables can be shared. > > Fortunately, we can drop the anon folio checks now. > > This has low urgency, as it requires racing with, for example, a page > fault in the private VMA, and migration is usually retried. > > Fixes: bf4916922c60 ("hugetlbfs: extend hugetlb_vma_lock to private VMAs") > Cc: stable@vger.kernel.org > Signed-off-by: David Hildenbrand (Arm) LGTM: Reviewed-by: Jose A. Perez de Azpillaga -- cheers, jose a. p-a