Commit 2ca987f1 authored by ZhangPeng's avatar ZhangPeng Committed by Ma Wupeng
Browse files

userswap: provide cpu info in userfault msg

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I6CAIM



--------------------------------

The uffd_msg.reserved3 field is used to transfer the CPU information of
the PF.

Signed-off-by: default avatarZhangPeng <zhangpeng362@huawei.com>
parent ef3a1632
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -218,6 +218,9 @@ static inline struct uffd_msg userfault_msg(unsigned long address,
		msg.arg.pagefault.flags |= UFFD_PAGEFAULT_FLAG_WP;
	if (features & UFFD_FEATURE_THREAD_ID)
		msg.arg.pagefault.feat.ptid = task_pid_vnr(current);
#ifdef CONFIG_USERSWAP
	uswap_get_cpu_id(reason, &msg);
#endif
	return msg;
}

+6 −0
Original line number Diff line number Diff line
@@ -66,6 +66,12 @@ static inline bool uswap_missing(struct vm_area_struct *vma)
	return false;
}

static inline void uswap_get_cpu_id(unsigned long reason, struct uffd_msg *msg)
{
	if (reason & VM_USWAP)
		msg->reserved3 = smp_processor_id();
}

#endif /* CONFIG_USERSWAP */

#endif /* _LINUX_USERSWAP_H */