Re: Calls to do_swap_page() from handle_pte_fault() on a system where swap is not configured
From: Gregory Price
Date: Wed Dec 03 2025 - 03:19:09 EST
On Wed, Dec 03, 2025 at 01:11:24PM +0530, Jayaraj Rajappan wrote:
> Hi,
>
> On a system where swap is not configured, profiling using Linux "perf"
> tool shows that do_swap_page() gets called from handle_pte_fault().
> Kernel version is 5.14.0. HugePages are disabled on the system. Trying
> to understand what could cause do_swap_page() to be called when there
> is no swap configured on the system.
>
all do_swap_page() call means is that the PTE is valid (something is
there) but not present (the present-bit is not set, or whatever that
particular architecture considers is present is not met)
static vm_fault_t handle_pte_fault(struct vm_fault *vmf)
{
...
if (!vmf->pte)
return do_pte_missing(vmf);
if (!pte_present(vmf->orig_pte))
return do_swap_page(vmf);
}
There are other non-swap swap-entries that are handled by the same code.
Transient migrations, device private, etc etc.
swap-entries are being renamed "softleaf" entries here shortly:
https://lore.kernel.org/linux-mm/cover.1762812360.git.lorenzo.stoakes@xxxxxxxxxx/
So it means "a software-entry is present" which could be any of:
enum softleaf_type {
/* Fundamental types. */
SOFTLEAF_NONE,
SOFTLEAF_SWAP,
/* Migration types. */
SOFTLEAF_MIGRATION_READ,
SOFTLEAF_MIGRATION_READ_EXCLUSIVE,
SOFTLEAF_MIGRATION_WRITE,
/* Device types. */
SOFTLEAF_DEVICE_PRIVATE_READ,
SOFTLEAF_DEVICE_PRIVATE_WRITE,
SOFTLEAF_DEVICE_EXCLUSIVE,
/* H/W posion types. */
SOFTLEAF_HWPOISON,
/* Marker types. */
SOFTLEAF_MARKER,
};
-------
+Cc Lorenzo:
do_swap_page() is a stale name now probably?
I know there was a hold-off on changing actual swap code, but maybe
worth changing do_swap_page -> do_softleaf_page?
Not build or anything tested (sorry it's 3am insomnia time), basically just:
s/do_swap_page/do_softleaf_page
s/DO_SWAP_PAGE/DO_SOFTLEAF_PAGE
No clue what's up with the special sparc stuff.
~Gregory
-------