From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.48 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796383901; b=E+P4MCWcHtvS1nH8XM1AS5RO0A3KN1AaqqWWcx8NQnDtbsYBb1eVa/gcoqgBGqM2mRAG zIUQnGxK+qqDgkRgcc85sZKG3m4SR5GwJ4TB4T48p4qDmu6wSq/6x/Kv+vI6xd0VIIbrI lqeVFiMLrJGP7lHMdgJJQG6FWhDa2s4l3Gw2SEjgRKvxLk+O7xwUHYEmABVJYH02FX928 idYwIoRAkV05v8SHJCmPg29FxqmmKtCfBNj5dLJsAYX+7vK2jvwaU+G8gysyG0k0WQUso lVaxuhO2+Jb78O4NQg1A3sMVpxkOH6+lEG3wh4IleS0Rw/1V+94p4JvOtm+bAqlyByw== 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=lI8YZm0i712kW95wdLHbP41l8AeSi5eBCueHSTy4qkHXwL0yLxMJUQ68ANBoZmJgJ84H dq0Gvfgr0wUrv+ybAeoUR88hgODehHDUZ8KKU8N8g40i2nXsfDpW45hcmbDUWvrq3kqm0 THCKSvWg8OTS8nmrzfaWMUYMGzE4Ur79aoFFriAjoeETc/UDPFAHRlahlJ05b7HDU607r lW+l34JNne/IpGuJjtJHirdAivJfMOi2X9iy7NGkIh6kreBhnYDXrvW59fUjjwFIZg/jt Vd8oMZTCTMzL+r51ix60gmnQlBk97ZxXr54pwGZUoQHPgnmbnQaxqIs8TGoQyBZ33Og== 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.48 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (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 B35D660A380B for ; Fri, 4 Dec 2026 11:31:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B35D660A380B 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-f48.google.com with SMTP id 5b1f17b1804b1-49d05d51553so5499235e9.2 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=GET0jxQ2MkH/DhiI6aJwOM0CCVl+xQ1fJpSdlBlUZVdxjnpM3VUHI6ZPWsEXIm3EzZ 2ENI5Ab8M7zoTPNaBPmwsk0R6/StNMPzv7rHlgs+KJH2TTLJQsU3I/CYiIfo2PT8YC7k 7TcmjmjMuPK4MJGtQlB5DeBTc0rdqpUUL0dwTe5pi4mZiBKT8J96gPxRXusjDatJtvgw OI2yD3O8eMXtconZIFABuNOLT3oJGeHhSx8ZZBkLOP3TpTWGlbopYr3vCpRhUFhTLMmu qtEqJBL5M65kJuGP63PW/hcSkpBT0VOUkpYTadAN8/6HSycy4XBTGD+tity03XcjlrjQ 4WrA== X-Forwarded-Encrypted: i=1; AL+hErFVhQkH/SwBvMiN3nnmIvB+7FhhswePqh0ZFUjGmxZpFwnNznDccok+DTwwEwGDXdtaWDD8TnXxhPk=@vger.kernel.org X-Gm-Message-State: APuU4Z8gXztP7bvHGF9ZAEf1IU3eIKWsD6Ih5UIhICVnPaZpT7rNH3dk HuS7YwDzJ84kfDm8Iy8b88oGHfj76PSYNLlNXWklzAM6aH5Ag0B9MmNz X-Gm-Gg: AZFdTZe2xfgH78UrKJ7mQhZ0e+1GE8iR0P2L/V4vCUCOPzEorBvfXAuoCN7ULZFJ4qA HU4vW8j3dfCeiHsGtw2mFl0YIAkppeL5SOu6bjlTkJkrUD2zX/A1gJ8eqqlIhP4bmQiyTBgdKuL 2Esl2JigfLN0jCepHmWsUkhu+bHBuksPaIhd/dRI4Bum5rBd4AcxB27BEmjqEPcNhOw+fw6T1oy pI9J9Ka0H3+BIXxOpekXgLQVhnmbHfIVgY37bQi8oKL7ocMfoj3EWflzQolFXgmFh6ESd+x90WJ W5xWRbPMxCOAi+n7sLnsp+YY/ocmjagI3IpGkD3GhOIVA5V1ReRkcIGeO2qLz7Iu5hpXtalFeXM Q6/bkDszVUVVrVdq10BI/xQPqH3Qys8B165NKcKw6WuG3w5N2djokW31O4U6TaTY94eG03fqHdC wVb9KDhCZE+jqkwkf7hlE6zy9H/9LBTek3LzuLz2kZ6daCEiwtNrjtLBHOuOIDtxyq8+wBMCvEY dW3mOsUit2N+lq7kHBMUvHnz3SXyv3BTtTYlMPL6OZSyWp6XKbgTVaiRs3KIBFCJrvA9uFRQukx aL1RrEl9NF5ijt1HB5WEfj1cJebVoXWvFYM/1NW1g81lkmg2BHJPdgc= 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: linux-doc@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