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 23E043A1689 for ; Fri, 10 Jul 2026 05:59:26 +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=1783663171; cv=none; b=AbaEZyNPvAA3oMCvjwPabXMF8Fw0j5lNaM+f4h0pgu5VYNeihuYyzOy/XwXxBHqLOEMtOYpae0tpoXGgBSlnqPY5gi993428AKQSODmMXvHEJxn0thVVcQec0NZOrWqYEY7p3SWjw1M8d0OhwWlj0sPUL49bsEt9Mz2R/8lWfAE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783663171; c=relaxed/simple; bh=Hdg/tLq6AWtfKBheXabe4Hz3TQClVfuMhfgdlP9/4jQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=qZ//7SFfIUdW2ZtUlonpciWDEhcfvxU2qSe9e3OwCKb9LikYu14b/7+xpRiixkRv45oEab/ijZgFMP1bKeuD+rvTvRItwkx2l3YCOE2d3Sn52B6cKfYu8N4RPfmBAUcj6PJI1FmEZaBwtwqrDYp/eDj1pNOQIeiNMRUdbbxeNgE= 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=OpGnhiW3; 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="OpGnhiW3" 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 51C6C1476; Thu, 9 Jul 2026 22:59:21 -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 46EC63F85F; Thu, 9 Jul 2026 22:59:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1783663165; bh=Hdg/tLq6AWtfKBheXabe4Hz3TQClVfuMhfgdlP9/4jQ=; h=From:To:Cc:Subject:Date:From; b=OpGnhiW33CuvRMljgllb0taozw6+R+0ep/mt8W9tWgbLEeLtvTT1Sdn70wdZ2oHfL YrP8Y/LtKtLGW0CY4miopWz/ayt8UvKwr7x+REHE5cpmoZI8fwwvee836LxDLj6ymm xN6nSnYjiOFF59x4yrbyq9nl4c6qvXl7b4EUZ7FU= 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 v2 0/5] mm/rmap: Refactor try_to_unmap_one Date: Fri, 10 Jul 2026 05:59:09 +0000 Message-ID: <20260710055915.638659-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. 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 | 420 ++++++++++++++++++++++------------------ 2 files changed, 237 insertions(+), 184 deletions(-) -- 2.43.0