From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.247 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796365882; b=TIvgu+WUct1Mmo31+8QNgq8wk0nuDdfk6w1LKwcoIaLNZgtQI4TKUG9BuOi2y4CQzp8w fPRVAuN/vqhM4TjuPaNs0pkObtjZqsoWMxVZVWYBN3abv77nDDApaAvZ6B8YLTlsTy1ol EecZ6ZaJCpcvoWRYisMH+nvdwr6URLKFdDmcgvb47U2prt1N4XAbgbyak2NczCRk7NtS2 uEkXl/Luo9RVjtuD52cg3UQykfZ/RmTePk3gGNug5RryoN41ShnGdYhvoKYHcgsZv8PWg Zmv9ccB8cK2kBWK+5kJRSkbW8i/Kl9JXYubXfKs7YoRmDzU5CFoT/cXQMUpEv5xJS5g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796365882; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Content-Type:Mime-Version:Subject:From: In-Reply-To:Date:Cc:Content-Transfer-Encoding:Message-Id:References: To:X-Mailer; bh=QtkIaUH1PEVHMCHE8+MVOXk85k6Fky9YmPA1QH8CokA=; b=n2KpdKzG0xtLmApG7jeFG7sE/HzZxK+evMhv3So8pljAoPLMwgrnbtUh+c9MNSeqzu2X o/lrbZcWYfjAki86KSukWkLzks1wgTkVFYCDj8E0D54uVsjElADg4/OokvnmizjgSSo6/ TbWtx8YIoGZxHciCfQHZThdFlglLFph7J8Lx8ruxztW3OAkW29fmOLhKGhp79/SibsxTb Vg8YRo8WAw77kbqr4UlBG/AHdK/nTnZcgq4GPN3Aood2Q4LdLe0NZTKLLeDFd5vDnQeHp EGE1S1vC+k1EcaoRbCjZlaHibhgVbddR7u6o1t7Y5aS8q/Xigmv0OgD430q+p2Xvreg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=GOXIU97W; arc=none smtp.remote-ip=95.215.58.247 Received: from mta1.migadu.com (out-247.mta1.migadu.com [95.215.58.247]) (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 BE4B8606A322 for ; Fri, 4 Dec 2026 06:31:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BE4B8606A322 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, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=GOXIU97W X-Envelope-To: linux-fsdevel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=vyK6OsINFQZkVXC8MII905Z9fjG+qs/TNcbT2hDweH8=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796365880; v=1; x=1796970680; b=GOXIU97WNH3ACKe6sm19cfA5iE4YAkkO97YGkm3rQks2Rf2O5gT5AQ9Vf1um/w477EgTvMmB hA6w9fG5OricXZkAaYkKGXQSAB31c3/RKfPfn4f8LM1VTY5pY0PcOWg4fgv42bsHDQQzoFuN47p yjeQVperE59rBK3e4FvGs2kw= X-Envelope-To: linux-fsdevel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id ef0d66ff424df810; Fri, 04 Dec 2026 06:31:19 +0000 X-Mizu-Trace-ID: ef0d66ff424df810 X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset=us-ascii X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3901.200.71.1.16\)) Subject: Re: [PATCH v2 26/35] mm/rmap: don't fail unmapping hugetlb folios from private VMAs From: Muchun Song In-Reply-To: <20261203-hugetlb_fixes_2-v2-26-9bbeabb555d2@kernel.org> Date: Fri, 4 Dec 2026 14:30:55 +0800 Cc: 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" , 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 Content-Transfer-Encoding: 7bit Message-Id: References: <20261203-hugetlb_fixes_2-v2-0-9bbeabb555d2@kernel.org> <20261203-hugetlb_fixes_2-v2-26-9bbeabb555d2@kernel.org> To: "David Hildenbrand (Arm)" X-Mailer: Apple Mail (2.3901.200.71.1.16) > On Dec 3, 2026, at 19:37, 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) Acked-by: Muchun Song (ByteDance) Thanks.