diff options
| author | Jakub Kicinski <kuba@kernel.org> | 2021-06-18 19:47:02 -0700 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2021-06-18 19:47:02 -0700 |
| commit | adc2e56ebe6377f5c032d96aee0feac30a640453 (patch) | |
| tree | f8937ffc72e1991418b0d54a0672766237855c94 /include/linux/swapops.h | |
| parent | 4bea7207a80c8bba3b3eb5b84c407b162968475f (diff) | |
| parent | 9ed13a17e38e0537e24d9b507645002bf8d0201f (diff) | |
| download | lwn-adc2e56ebe6377f5c032d96aee0feac30a640453.tar.gz lwn-adc2e56ebe6377f5c032d96aee0feac30a640453.zip | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Trivial conflicts in net/can/isotp.c and
tools/testing/selftests/net/mptcp/mptcp_connect.sh
scaled_ppm_to_ppb() was moved from drivers/ptp/ptp_clock.c
to include/linux/ptp_clock_kernel.h in -next so re-apply
the fix there.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/linux/swapops.h')
| -rw-r--r-- | include/linux/swapops.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/include/linux/swapops.h b/include/linux/swapops.h index d9b7c9132c2f..6430a94c6981 100644 --- a/include/linux/swapops.h +++ b/include/linux/swapops.h @@ -23,6 +23,16 @@ #define SWP_TYPE_SHIFT (BITS_PER_XA_VALUE - MAX_SWAPFILES_SHIFT) #define SWP_OFFSET_MASK ((1UL << SWP_TYPE_SHIFT) - 1) +/* Clear all flags but only keep swp_entry_t related information */ +static inline pte_t pte_swp_clear_flags(pte_t pte) +{ + if (pte_swp_soft_dirty(pte)) + pte = pte_swp_clear_soft_dirty(pte); + if (pte_swp_uffd_wp(pte)) + pte = pte_swp_clear_uffd_wp(pte); + return pte; +} + /* * Store a type+offset into a swp_entry_t in an arch-independent format */ @@ -66,10 +76,7 @@ static inline swp_entry_t pte_to_swp_entry(pte_t pte) { swp_entry_t arch_entry; - if (pte_swp_soft_dirty(pte)) - pte = pte_swp_clear_soft_dirty(pte); - if (pte_swp_uffd_wp(pte)) - pte = pte_swp_clear_uffd_wp(pte); + pte = pte_swp_clear_flags(pte); arch_entry = __pte_to_swp_entry(pte); return swp_entry(__swp_type(arch_entry), __swp_offset(arch_entry)); } |
