get_mempolicy: Support (MPOL_F_NODE | MPOL_F_ADDR) specified

If flags specifies both MPOL_F_NODE and MPOL_F_ADDR,
get_mempolicy() will return the node ID of the node on
which the address addr is allocated into the location pointed to by mode.

Change-Id: Id485e3f4838e3679d877a95e53b21e3421cac88a
This commit is contained in:
Ken Sato
2020-11-30 14:23:51 +09:00
committed by Masamichi Takagi
parent aef50d710c
commit 9f1e6d707c
3 changed files with 57 additions and 0 deletions

View File

@ -10153,6 +10153,20 @@ SYSCALL_DECLARE(get_mempolicy)
}
}
/* case of MPOL_F_NODE and MPOL_F_ADDR are specified */
if (flags & MPOL_F_NODE && flags & MPOL_F_ADDR) {
/* return the node ID which addr is allocated by mode */
int nid;
nid = lookup_node(vm, (void *)addr);
error = copy_to_user(mode, &nid, sizeof(int));
if (error) {
error = -EFAULT;
goto out;
}
goto out;
}
/* Special case of MPOL_F_MEMS_ALLOWED */
if (flags == MPOL_F_MEMS_ALLOWED) {
if (nodemask) {