From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1AB9C1DED40 for ; Mon, 13 Jul 2026 05:01:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783918869; cv=none; b=Z/ux60MjzLPxi6wzkY123E8Q9aifuIfQx3gwUBz1vlmavgKmjpNjWrbwg9342b+uMvrNGyK8YkjPOI0Py5995MlLPJLdNBO826kkyBnci6eoW7P8UGIR26Adw2AXvQRHRRY4Ixw8VubDMuHlXtoVZvLgvqS881IthkkQh4p+heQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783918869; c=relaxed/simple; bh=CPHFu/HOUKfGUBhv1RIN/ECa0WyCmUkHetizFU3uUJ4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=rXdJy/Uo5t5wuPTJpouypyg2SawOQu6l/VeiplegHl4aITRqQO5u2sPZZt2BIcW+WjNdZvyor8yOhD4Xm/GmkUenTcrIgDA081lIbSG8cHKSl1WH2mNxxDMuZJK4QpD8999KEUnp3E3a4k2ncZFn7vASAvuKAyndsfRV1jCTeX0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=agt6Kmhk; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="agt6Kmhk" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B7959497; Sun, 12 Jul 2026 22:01:00 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-01.blr.arm.com (cesw-amp-gbt-1s-m12830-01.blr.arm.com [10.164.195.33]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B29AF3F93E; Sun, 12 Jul 2026 22:01:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1783918865; bh=CPHFu/HOUKfGUBhv1RIN/ECa0WyCmUkHetizFU3uUJ4=; h=From:To:Cc:Subject:Date:From; b=agt6Kmhk10EuC+oLXQPFGu2ZK+BpREh3mJTtgNRzoZJ61TeDXZHENPIXPihq5fZEB F5osFeXgTPcyImTqXgC9XWC31TDBsDIUN60pWc55Z7CWAozc2pa35AmReWYzUH/cfL bYdHo5HtSyeRL7HgrZ5tXlVOSm2shXf95LGTyAuY= From: Dev Jain To: akpm@linux-foundation.org, david@kernel.org, ljs@kernel.org, muchun.song@linux.dev, osalvador@suse.de Cc: Dev Jain , riel@surriel.com, liam@infradead.org, vbabka@kernel.org, harry@kernel.org, jannh@google.com, lance.yang@linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, ryan.roberts@arm.com, anshuman.khandual@arm.com Subject: [PATCH v3 0/5] mm/rmap: Refactor try_to_unmap_one Date: Mon, 13 Jul 2026 05:00:43 +0000 Message-ID: <20260713050050.1017741-1-dev.jain@arm.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In preparation for batching anonymous large folio unmapping to optimize it, refactor try_to_unmap_one. This series refactors hugetlb, anon-lazyfree and anon-swapbacked logic into their own functions, significantly reducing the length of the huge try_to_unmap_one. --- Split out from https://lore.kernel.org/all/20260526063635.61721-1-dev.jain@arm.com/ mm-selftests pass on arm64, built on arm64 and x86. v2->v3: - Patch 2: fix comment to say that TTU_HWPOISON can be true for small folios only in try_to_unmap_one, since hugetlb bits are now refactored away - Patch 5: Directly do if (WARN_ON_ONCE()) - Rebase on latest mm-unstable to resolve conflicts with 30c83145c5b3 ("mm: rename uffd-wp PTE accessors to uffd") v1->v2: - constify ttu flags in try_to_unmap_hugetlb_one, move const variables up - Assert address passed to try_to_unmap_hugetlb_one equals pvmw.address - Patch 3: code and comment polishing, do the stat update in the function - Remove unnecessary inline hints, remove set_swp_pte_at, instead have swp_pte_prepare + set_ptes. Rename subpage -> page. constify anon_exclusive. - Do pte restoration in caller Dev Jain (5): mm/rmap: convert page -> folio for hwpoison checks mm/rmap: Add try_to_unmap_hugetlb_one mm/rmap: refactor some code around lazyfree folio unmapping mm/rmap: refactor anon folio unmap in try_to_unmap_one mm/rmap: add anon folio unmap dispatcher include/linux/hugetlb.h | 1 + mm/rmap.c | 415 ++++++++++++++++++++++------------------ 2 files changed, 232 insertions(+), 184 deletions(-) -- 2.43.0