* [PATCH v2] selftests/move_mount_set_group:Make tests build with old libc
From: Hu Yadi @ 2024-01-10 7:29 UTC (permalink / raw)
To: jmorris, serge, shuah, mathieu.desnoyers, mic
Cc: linux-api, linux-kernel, linux-security-module, linux-kselftest,
514118380, berlin, Hu.Yadi
From: "Hu.Yadi" <hu.yadi@h3c.com>
Replace SYS_<syscall> with __NR_<syscall>. Using the __NR_<syscall>
notation, provided by UAPI, is useful to build tests on systems without
the SYS_<syscall> definitions.
Replace SYS_move_mount with __NR_move_mount
Signed-off-by: Hu.Yadi <hu.yadi@h3c.com>
Suggested-by:Jiao <jiaoxupo@h3c.com>
Reviewed-by:Berlin <berlin@h3c.com>
---
Changes v1 -> v2:
- Fix mail of Suggested-by and Reviewed-by
.../move_mount_set_group/move_mount_set_group_test.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c b/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c
index 50ed5d475dd1..bcf51d785a37 100644
--- a/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c
+++ b/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c
@@ -218,7 +218,7 @@ static bool move_mount_set_group_supported(void)
if (mount(NULL, SET_GROUP_FROM, NULL, MS_SHARED, 0))
return -1;
- ret = syscall(SYS_move_mount, AT_FDCWD, SET_GROUP_FROM,
+ ret = syscall(__NR_move_mount, AT_FDCWD, SET_GROUP_FROM,
AT_FDCWD, SET_GROUP_TO, MOVE_MOUNT_SET_GROUP);
umount2("/tmp", MNT_DETACH);
@@ -363,7 +363,7 @@ TEST_F(move_mount_set_group, complex_sharing_copying)
CLONE_VM | CLONE_FILES); ASSERT_GT(pid, 0);
ASSERT_EQ(wait_for_pid(pid), 0);
- ASSERT_EQ(syscall(SYS_move_mount, ca_from.mntfd, "",
+ ASSERT_EQ(syscall(__NR_move_mount, ca_from.mntfd, "",
ca_to.mntfd, "", MOVE_MOUNT_SET_GROUP
| MOVE_MOUNT_F_EMPTY_PATH | MOVE_MOUNT_T_EMPTY_PATH),
0);
--
2.23.0
^ permalink raw reply related
* [PATCH] selftests/landlock:Fix two build issues
From: Hu Yadi @ 2024-01-10 7:08 UTC (permalink / raw)
To: jmorris, serge, shuah, mathieu.desnoyers, mic
Cc: linux-api, linux-kernel, linux-security-module, linux-kselftest,
514118380, berlin, Hu.Yadi
From: "Hu.Yadi" <hu.yadi@h3c.com>
Two issues comes up while building selftest/landlock:
the first one is as to gettid
net_test.c: In function ‘set_service’:
net_test.c:91:45: warning: implicit declaration of function ‘gettid’; did you mean ‘getgid’? [-Wimplicit-function-declaration]
"_selftests-landlock-net-tid%d-index%d", gettid(),
^~~~~~
getgid
net_test.c:(.text+0x4e0): undefined reference to `gettid'
the second is compiler error
gcc -Wall -O2 -isystem fs_test.c -lcap -o /home/linux/tools/testing/selftests/landlock/fs_test
fs_test.c:4575:9: error: initializer element is not constant
.mnt = mnt_tmp,
^~~~~~~
this patch is to fix them
Signed-off-by: Hu.Yadi <hu.yadi@h3c.com>
Suggested-by: Jiao <jiaoxupo@h3c.com>
Reviewed-by:Berlin <berlin@h3c.com>
---
tools/testing/selftests/landlock/fs_test.c | 5 ++++-
tools/testing/selftests/landlock/net_test.c | 3 +--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/landlock/fs_test.c b/tools/testing/selftests/landlock/fs_test.c
index 18e1f86a6234..93eb40a09073 100644
--- a/tools/testing/selftests/landlock/fs_test.c
+++ b/tools/testing/selftests/landlock/fs_test.c
@@ -4572,7 +4572,10 @@ FIXTURE_VARIANT(layout3_fs)
/* clang-format off */
FIXTURE_VARIANT_ADD(layout3_fs, tmpfs) {
/* clang-format on */
- .mnt = mnt_tmp,
+ .mnt = {
+ .type = "tmpfs",
+ .data = "size=4m,mode=700",
+ },
.file_path = file1_s1d1,
};
diff --git a/tools/testing/selftests/landlock/net_test.c b/tools/testing/selftests/landlock/net_test.c
index 929e21c4db05..8fb357de8c55 100644
--- a/tools/testing/selftests/landlock/net_test.c
+++ b/tools/testing/selftests/landlock/net_test.c
@@ -18,7 +18,6 @@
#include <sys/prctl.h>
#include <sys/socket.h>
#include <sys/un.h>
-
#include "common.h"
const short sock_port_start = (1 << 10);
@@ -88,7 +87,7 @@ static int set_service(struct service_fixture *const srv,
case AF_UNIX:
srv->unix_addr.sun_family = prot.domain;
sprintf(srv->unix_addr.sun_path,
- "_selftests-landlock-net-tid%d-index%d", gettid(),
+ "_selftests-landlock-net-tid%ld-index%d", syscall(SYS_gettid),
index);
srv->unix_addr_len = SUN_LEN(&srv->unix_addr);
srv->unix_addr.sun_path[0] = '\0';
--
2.23.0
^ permalink raw reply related
* [PATCH] selftests/move_mount_set_group:Make tests build with old libc
From: Hu Yadi @ 2024-01-10 6:40 UTC (permalink / raw)
To: jmorris, serge, shuah, mathieu.desnoyers
Cc: linux-api, linux-kernel, linux-security-module, linux-kselftest,
514118380, Hu.Yadi
From: "Hu.Yadi" <hu.yadi@h3c.com>
Replace SYS_<syscall> with __NR_<syscall>. Using the __NR_<syscall>
notation, provided by UAPI, is useful to build tests on systems without
the SYS_<syscall> definitions.
Replace SYS_move_mount with __NR_move_mount
Signed-off-by: Hu.Yadi <hu.yadi@h3c.com>
Suggested-by:jiaoxupo@h3c.com
Reviewed-by:berlin@h3c.com
---
.../move_mount_set_group/move_mount_set_group_test.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c b/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c
index 50ed5d475dd1..bcf51d785a37 100644
--- a/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c
+++ b/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c
@@ -218,7 +218,7 @@ static bool move_mount_set_group_supported(void)
if (mount(NULL, SET_GROUP_FROM, NULL, MS_SHARED, 0))
return -1;
- ret = syscall(SYS_move_mount, AT_FDCWD, SET_GROUP_FROM,
+ ret = syscall(__NR_move_mount, AT_FDCWD, SET_GROUP_FROM,
AT_FDCWD, SET_GROUP_TO, MOVE_MOUNT_SET_GROUP);
umount2("/tmp", MNT_DETACH);
@@ -363,7 +363,7 @@ TEST_F(move_mount_set_group, complex_sharing_copying)
CLONE_VM | CLONE_FILES); ASSERT_GT(pid, 0);
ASSERT_EQ(wait_for_pid(pid), 0);
- ASSERT_EQ(syscall(SYS_move_mount, ca_from.mntfd, "",
+ ASSERT_EQ(syscall(__NR_move_mount, ca_from.mntfd, "",
ca_to.mntfd, "", MOVE_MOUNT_SET_GROUP
| MOVE_MOUNT_F_EMPTY_PATH | MOVE_MOUNT_T_EMPTY_PATH),
0);
--
2.23.0
^ permalink raw reply related
* Re: [PATCH v4 6/6] wire up syscalls for statmount/listmount
From: Florian Fainelli @ 2024-01-09 1:11 UTC (permalink / raw)
To: Miklos Szeredi, linux-fsdevel
Cc: linux-kernel, linux-api, linux-man, linux-security-module,
Karel Zak, Ian Kent, David Howells, Linus Torvalds, Al Viro,
Christian Brauner, Amir Goldstein, Matthew House, Florian Weimer,
Arnd Bergmann
In-Reply-To: <20231025140205.3586473-7-mszeredi@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 5197 bytes --]
Hello,
On 10/25/23 07:02, Miklos Szeredi wrote:
> Wire up all archs.
>
> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
> ---
> arch/alpha/kernel/syscalls/syscall.tbl | 3 +++
> arch/arm/tools/syscall.tbl | 3 +++
> arch/arm64/include/asm/unistd32.h | 4 ++++
> arch/ia64/kernel/syscalls/syscall.tbl | 3 +++
> arch/m68k/kernel/syscalls/syscall.tbl | 3 +++
> arch/microblaze/kernel/syscalls/syscall.tbl | 3 +++
> arch/mips/kernel/syscalls/syscall_n32.tbl | 3 +++
> arch/mips/kernel/syscalls/syscall_n64.tbl | 3 +++
> arch/mips/kernel/syscalls/syscall_o32.tbl | 3 +++
> arch/parisc/kernel/syscalls/syscall.tbl | 3 +++
> arch/powerpc/kernel/syscalls/syscall.tbl | 3 +++
> arch/s390/kernel/syscalls/syscall.tbl | 3 +++
> arch/sh/kernel/syscalls/syscall.tbl | 3 +++
> arch/sparc/kernel/syscalls/syscall.tbl | 3 +++
> arch/x86/entry/syscalls/syscall_32.tbl | 3 +++
> arch/x86/entry/syscalls/syscall_64.tbl | 2 ++
> arch/xtensa/kernel/syscalls/syscall.tbl | 3 +++
> include/uapi/asm-generic/unistd.h | 8 +++++++-
> 18 files changed, 58 insertions(+), 1 deletion(-)
FWIW, this broke the compat build on ARM64:
./arch/arm64/include/asm/unistd32.h:922:24: error: array index in
initializer exceeds array bounds
922 | #define __NR_statmount 457
| ^~~
arch/arm64/kernel/sys32.c:130:34: note: in definition of macro '__SYSCALL'
130 | #define __SYSCALL(nr, sym) [nr] = __arm64_##sym,
| ^~
./arch/arm64/include/asm/unistd32.h:923:11: note: in expansion of macro
'__NR_statmount'
923 | __SYSCALL(__NR_statmount, sys_statmount)
| ^~~~~~~~~~~~~~
./arch/arm64/include/asm/unistd32.h:922:24: note: (near initialization
for 'compat_sys_call_table')
922 | #define __NR_statmount 457
| ^~~
arch/arm64/kernel/sys32.c:130:34: note: in definition of macro '__SYSCALL'
130 | #define __SYSCALL(nr, sym) [nr] = __arm64_##sym,
| ^~
./arch/arm64/include/asm/unistd32.h:923:11: note: in expansion of macro
'__NR_statmount'
923 | __SYSCALL(__NR_statmount, sys_statmount)
| ^~~~~~~~~~~~~~
arch/arm64/kernel/sys32.c:130:40: warning: excess elements in array
initializer
130 | #define __SYSCALL(nr, sym) [nr] = __arm64_##sym,
| ^~~~~~~~
./arch/arm64/include/asm/unistd32.h:923:1: note: in expansion of macro
'__SYSCALL'
923 | __SYSCALL(__NR_statmount, sys_statmount)
| ^~~~~~~~~
arch/arm64/kernel/sys32.c:130:40: note: (near initialization for
'compat_sys_call_table')
130 | #define __SYSCALL(nr, sym) [nr] = __arm64_##sym,
| ^~~~~~~~
./arch/arm64/include/asm/unistd32.h:923:1: note: in expansion of macro
'__SYSCALL'
923 | __SYSCALL(__NR_statmount, sys_statmount)
| ^~~~~~~~~
./arch/arm64/include/asm/unistd32.h:924:24: error: array index in
initializer exceeds array bounds
924 | #define __NR_listmount 458
| ^~~
arch/arm64/kernel/sys32.c:130:34: note: in definition of macro '__SYSCALL'
130 | #define __SYSCALL(nr, sym) [nr] = __arm64_##sym,
| ^~
./arch/arm64/include/asm/unistd32.h:925:11: note: in expansion of macro
'__NR_listmount'
925 | __SYSCALL(__NR_listmount, sys_listmount)
| ^~~~~~~~~~~~~~
./arch/arm64/include/asm/unistd32.h:924:24: note: (near initialization
for 'compat_sys_call_table')
924 | #define __NR_listmount 458
| ^~~
arch/arm64/kernel/sys32.c:130:34: note: in definition of macro '__SYSCALL'
130 | #define __SYSCALL(nr, sym) [nr] = __arm64_##sym,
| ^~
./arch/arm64/include/asm/unistd32.h:925:11: note: in expansion of macro
'__NR_listmount'
925 | __SYSCALL(__NR_listmount, sys_listmount)
| ^~~~~~~~~~~~~~
arch/arm64/kernel/sys32.c:130:40: warning: excess elements in array
initializer
130 | #define __SYSCALL(nr, sym) [nr] = __arm64_##sym,
| ^~~~~~~~
./arch/arm64/include/asm/unistd32.h:925:1: note: in expansion of macro
'__SYSCALL'
925 | __SYSCALL(__NR_listmount, sys_listmount)
| ^~~~~~~~~
arch/arm64/kernel/sys32.c:130:40: note: (near initialization for
'compat_sys_call_table')
130 | #define __SYSCALL(nr, sym) [nr] = __arm64_##sym,
| ^~~~~~~~
./arch/arm64/include/asm/unistd32.h:925:1: note: in expansion of macro
'__SYSCALL'
925 | __SYSCALL(__NR_listmount, sys_listmount)
| ^~~~~~~~~
host-make[5]: *** [scripts/Makefile.build:243:
arch/arm64/kernel/sys32.o] Error 1
host-make[4]: *** [scripts/Makefile.build:480: arch/arm64/kernel] Error 2
host-make[3]: *** [scripts/Makefile.build:480: arch/arm64] Error 2
host-make[3]: *** Waiting for unfinished jobs....
Sent out a fix for that:
https://lore.kernel.org/all/20240109010906.429652-1-florian.fainelli@broadcom.com/
--
Florian
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]
^ permalink raw reply
* Re: [PATCH 4/5] Documentation/ABI/README: convert to ReST
From: Vegard Nossum @ 2024-01-08 13:18 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Jonathan Corbet
Cc: Randy Dunlap, Greg Kroah-Hartman, Jani Nikula, linux-doc,
linux-api
In-Reply-To: <20240105210739.20ae5f05@coco.lan>
[-- Attachment #1: Type: text/plain, Size: 2569 bytes --]
On 05/01/2024 21:07, Mauro Carvalho Chehab wrote:
> Em Thu, 4 Jan 2024 17:09:45 +0100
> Vegard Nossum <vegard.nossum@oracle.com> escreveu:
>> +Every file in these directories will contain the following information::
>> +
>> + What: Short description of the interface
>> + Date: Date created
>> + KernelVersion: Kernel version this feature first showed up in.
>> + Contact: Primary contact for this interface (may be a mailing list)
>> + Description: Long description of the interface and how to use it.
>> + Users: All users of this interface who wish to be notified when
>> + it changes. This is very important for interfaces in
>> + the "testing" stage, so that kernel developers can work
>> + with userspace developers to ensure that things do not
>> + break in ways that are unacceptable. It is also
>> + important to get feedback for these interfaces to make
>> + sure they are working in a proper way and do not need to
>> + be changed further.
>
> My personal preference would be to use:
>
> :What:
>
> as this produces a better markup.
I would prefer to alter this as little as possible, since it describes
the literal format of those ABI files, keeping it readable and
understandable in plain text as well as HTML -- with a single leading
space this whole block shows up as a code block in the HTML, which I
think is appropriate when giving an example of a literal file.
>> diff --git a/Documentation/process/submit-checklist.rst b/Documentation/process/submit-checklist.rst
>> index b1bc2d37bd0a..7e6198ab368d 100644
>> --- a/Documentation/process/submit-checklist.rst
>> +++ b/Documentation/process/submit-checklist.rst
>> @@ -85,7 +85,7 @@ and elsewhere regarding submitting Linux kernel patches.
>> 17) All new module parameters are documented with ``MODULE_PARM_DESC()``
>>
>> 18) All new userspace interfaces are documented in ``Documentation/ABI/``.
>> - See ``Documentation/ABI/README`` for more information.
>> + See ``Documentation/ABI/README.rst`` for more information.
>
> If you're willing to convert to ReST, please remove ``, as this will
> let automarkup.py to create cross-reference links. Same note for the
> translations too.
Good point -- Jon, do you want me to resubmit this or can you fix it up?
We could also just run a "treewide" fix for this as a separate patch:
git grep -l '``Documentation/.*\.rst``' 'Documentation/**.rst' \
| xargs sed -i 's|``\(Documentation[^`*]*\.rst\)``|\1|g'
I've attached the result (with 1 exclusion, see the changelog) as a patch.
Thanks,
Vegard
[-- Attachment #2: 0001-docs-rely-on-automarkup-for-Documentation-.rst-links.patch --]
[-- Type: text/x-patch, Size: 31853 bytes --]
From 262186f2bc7ca72dbb8b68e282d3e418918fe6d8 Mon Sep 17 00:00:00 2001
From: Vegard Nossum <vegard.nossum@oracle.com>
Date: Mon, 8 Jan 2024 14:11:02 +0100
Subject: [PATCH] docs: rely on automarkup for Documentation/**.rst links
If we remove ``...`` around Documentation/ links to .rst files in .rst
files, then automarkup.py can create cross-reference links and warn about
non-existent files.
git grep -l '``Documentation/.*\.rst``' 'Documentation/**.rst' \
| xargs sed -i 's|``\(Documentation[^`*]*\.rst\)``|\1|g'
I've excluded one instance in Documentation/doc-guide/sphinx.rst to the
top-level Documentation/index.rst file as I believe it makes more sense
to keep that as a literal path.
Link: https://lore.kernel.org/all/20240105210739.20ae5f05@coco.lan/
Suggested-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
---
Documentation/admin-guide/mm/numa_memory_policy.rst | 2 +-
Documentation/admin-guide/serial-console.rst | 2 +-
Documentation/driver-api/dmaengine/client.rst | 2 +-
Documentation/driver-api/nvdimm/security.rst | 2 +-
Documentation/filesystems/fscrypt.rst | 4 ++--
Documentation/kernel-hacking/hacking.rst | 6 +++---
Documentation/kernel-hacking/locking.rst | 2 +-
Documentation/networking/dsa/b53.rst | 2 +-
Documentation/networking/dsa/bcm_sf2.rst | 2 +-
Documentation/networking/dsa/dsa.rst | 2 +-
Documentation/networking/dsa/lan9303.rst | 2 +-
Documentation/process/adding-syscalls.rst | 2 +-
Documentation/process/submit-checklist.rst | 8 ++++----
Documentation/security/keys/trusted-encrypted.rst | 4 ++--
Documentation/sound/kernel-api/writing-an-alsa-driver.rst | 2 +-
Documentation/translations/it_IT/doc-guide/sphinx.rst | 2 +-
.../translations/it_IT/kernel-hacking/hacking.rst | 6 +++---
.../translations/it_IT/kernel-hacking/locking.rst | 2 +-
.../translations/it_IT/process/adding-syscalls.rst | 2 +-
.../translations/it_IT/process/submit-checklist.rst | 8 ++++----
.../translations/sp_SP/process/adding-syscalls.rst | 2 +-
.../translations/sp_SP/process/submit-checklist.rst | 8 ++++----
Documentation/translations/zh_CN/doc-guide/sphinx.rst | 2 +-
.../translations/zh_CN/process/submit-checklist.rst | 6 +++---
.../translations/zh_TW/process/submit-checklist.rst | 6 +++---
Documentation/userspace-api/media/v4l/dev-sliced-vbi.rst | 2 +-
Documentation/userspace-api/media/v4l/diff-v4l.rst | 2 +-
Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 2 +-
Documentation/virt/uml/user_mode_linux_howto_v2.rst | 2 +-
29 files changed, 48 insertions(+), 48 deletions(-)
diff --git a/Documentation/admin-guide/mm/numa_memory_policy.rst b/Documentation/admin-guide/mm/numa_memory_policy.rst
index eca38fa81e0f..7d43b8042a05 100644
--- a/Documentation/admin-guide/mm/numa_memory_policy.rst
+++ b/Documentation/admin-guide/mm/numa_memory_policy.rst
@@ -13,7 +13,7 @@ document attempts to describe the concepts and APIs of the 2.6 memory policy
support.
Memory policies should not be confused with cpusets
-(``Documentation/admin-guide/cgroup-v1/cpusets.rst``)
+(Documentation/admin-guide/cgroup-v1/cpusets.rst)
which is an administrative mechanism for restricting the nodes from which
memory may be allocated by a set of processes. Memory policies are a
programming interface that a NUMA-aware application can take advantage of. When
diff --git a/Documentation/admin-guide/serial-console.rst b/Documentation/admin-guide/serial-console.rst
index a3dfc2c66e01..0befd17f66b6 100644
--- a/Documentation/admin-guide/serial-console.rst
+++ b/Documentation/admin-guide/serial-console.rst
@@ -84,7 +84,7 @@ You will need to create a new device to use ``/dev/console``. The official
``/dev/console`` is now character device 5,1.
(You can also use a network device as a console. See
-``Documentation/networking/netconsole.rst`` for information on that.)
+Documentation/networking/netconsole.rst for information on that.)
Here's an example that will use ``/dev/ttyS1`` (COM2) as the console.
Replace the sample values as needed.
diff --git a/Documentation/driver-api/dmaengine/client.rst b/Documentation/driver-api/dmaengine/client.rst
index ecf139f73da4..bf1346792855 100644
--- a/Documentation/driver-api/dmaengine/client.rst
+++ b/Documentation/driver-api/dmaengine/client.rst
@@ -5,7 +5,7 @@ DMA Engine API Guide
Vinod Koul <vinod dot koul at intel.com>
.. note:: For DMA Engine usage in async_tx please see:
- ``Documentation/crypto/async-tx-api.rst``
+ Documentation/crypto/async-tx-api.rst
Below is a guide to device driver writers on how to use the Slave-DMA API of the
diff --git a/Documentation/driver-api/nvdimm/security.rst b/Documentation/driver-api/nvdimm/security.rst
index eb3d35e6a95c..6deb677dea3b 100644
--- a/Documentation/driver-api/nvdimm/security.rst
+++ b/Documentation/driver-api/nvdimm/security.rst
@@ -51,7 +51,7 @@ all the keys are in the kernel user keyring for unlock.
A nvdimm encrypted-key of format enc32 has the description format of:
nvdimm:<bus-provider-specific-unique-id>
-See file ``Documentation/security/keys/trusted-encrypted.rst`` for creating
+See file Documentation/security/keys/trusted-encrypted.rst for creating
encrypted-keys of enc32 format. TPM usage with a master trusted key is
preferred for sealing the encrypted-keys.
diff --git a/Documentation/filesystems/fscrypt.rst b/Documentation/filesystems/fscrypt.rst
index 1b84f818e574..d6a93e47e70c 100644
--- a/Documentation/filesystems/fscrypt.rst
+++ b/Documentation/filesystems/fscrypt.rst
@@ -874,7 +874,7 @@ as follows:
hash of the key. To add this type of key, the calling process does
not need any privileges. However, the number of keys that can be
added is limited by the user's quota for the keyrings service (see
- ``Documentation/security/keys/core.rst``).
+ Documentation/security/keys/core.rst).
- ``raw_size`` must be the size of the ``raw`` key provided, in bytes.
Alternatively, if ``key_id`` is nonzero, this field must be 0, since
@@ -956,7 +956,7 @@ access encrypted files.
Nevertheless, to add a key to one of the process-subscribed keyrings,
the add_key() system call can be used (see:
-``Documentation/security/keys/core.rst``). The key type must be
+Documentation/security/keys/core.rst). The key type must be
"logon"; keys of this type are kept in kernel memory and cannot be
read back by userspace. The key description must be "fscrypt:"
followed by the 16-character lower case hex representation of the
diff --git a/Documentation/kernel-hacking/hacking.rst b/Documentation/kernel-hacking/hacking.rst
index 1717348a4404..05338ef0912f 100644
--- a/Documentation/kernel-hacking/hacking.rst
+++ b/Documentation/kernel-hacking/hacking.rst
@@ -736,7 +736,7 @@ make a neat patch, there's administrative work to be done:
- Usually you want a configuration option for your kernel hack. Edit
``Kconfig`` in the appropriate directory. The Config language is
simple to use by cut and paste, and there's complete documentation in
- ``Documentation/kbuild/kconfig-language.rst``.
+ Documentation/kbuild/kconfig-language.rst.
In your description of the option, make sure you address both the
expert user and the user who knows nothing about your feature.
@@ -746,7 +746,7 @@ make a neat patch, there's administrative work to be done:
- Edit the ``Makefile``: the CONFIG variables are exported here so you
can usually just add a "obj-$(CONFIG_xxx) += xxx.o" line. The syntax
- is documented in ``Documentation/kbuild/makefiles.rst``.
+ is documented in Documentation/kbuild/makefiles.rst.
- Put yourself in ``CREDITS`` if you consider what you've done
noteworthy, usually beyond a single file (your name should be at the
@@ -755,7 +755,7 @@ make a neat patch, there's administrative work to be done:
it implies a more-than-passing commitment to some part of the code.
- Finally, don't forget to read
- ``Documentation/process/submitting-patches.rst``
+ Documentation/process/submitting-patches.rst
Kernel Cantrips
===============
diff --git a/Documentation/kernel-hacking/locking.rst b/Documentation/kernel-hacking/locking.rst
index dff0646a717b..d479c2459895 100644
--- a/Documentation/kernel-hacking/locking.rst
+++ b/Documentation/kernel-hacking/locking.rst
@@ -1370,7 +1370,7 @@ Futex API reference
Further reading
===============
-- ``Documentation/locking/spinlocks.rst``: Linus Torvalds' spinlocking
+- Documentation/locking/spinlocks.rst: Linus Torvalds' spinlocking
tutorial in the kernel sources.
- Unix Systems for Modern Architectures: Symmetric Multiprocessing and
diff --git a/Documentation/networking/dsa/b53.rst b/Documentation/networking/dsa/b53.rst
index 1cb3ff648f88..51fd39ca5201 100644
--- a/Documentation/networking/dsa/b53.rst
+++ b/Documentation/networking/dsa/b53.rst
@@ -14,7 +14,7 @@ Implementation details
======================
The driver is located in ``drivers/net/dsa/b53/`` and is implemented as a
-DSA driver; see ``Documentation/networking/dsa/dsa.rst`` for details on the
+DSA driver; see Documentation/networking/dsa/dsa.rst for details on the
subsystem and what it provides.
The switch is, if possible, configured to enable a Broadcom specific 4-bytes
diff --git a/Documentation/networking/dsa/bcm_sf2.rst b/Documentation/networking/dsa/bcm_sf2.rst
index d2571435696f..ba7371aad142 100644
--- a/Documentation/networking/dsa/bcm_sf2.rst
+++ b/Documentation/networking/dsa/bcm_sf2.rst
@@ -39,7 +39,7 @@ Implementation details
======================
The driver is located in ``drivers/net/dsa/bcm_sf2.c`` and is implemented as a DSA
-driver; see ``Documentation/networking/dsa/dsa.rst`` for details on the subsystem
+driver; see Documentation/networking/dsa/dsa.rst for details on the subsystem
and what it provides.
The SF2 switch is configured to enable a Broadcom specific 4-bytes switch tag
diff --git a/Documentation/networking/dsa/dsa.rst b/Documentation/networking/dsa/dsa.rst
index 7b2e69cd7ef0..6e185a08396b 100644
--- a/Documentation/networking/dsa/dsa.rst
+++ b/Documentation/networking/dsa/dsa.rst
@@ -1110,7 +1110,7 @@ interface with a physical switch port does not produce the expected result).
A driver which is able of offloading certain functions of a DANP or DANH should
declare the corresponding netdev features as indicated by the documentation at
-``Documentation/networking/netdev-features.rst``. Additionally, the following
+Documentation/networking/netdev-features.rst. Additionally, the following
methods must be implemented:
- ``port_hsr_join``: function invoked when a given switch port is added to a
diff --git a/Documentation/networking/dsa/lan9303.rst b/Documentation/networking/dsa/lan9303.rst
index ab81b4e0139e..97456316a8d9 100644
--- a/Documentation/networking/dsa/lan9303.rst
+++ b/Documentation/networking/dsa/lan9303.rst
@@ -10,7 +10,7 @@ host conduit network interface (e.g. fixed link).
Driver details
==============
-The driver is implemented as a DSA driver, see ``Documentation/networking/dsa/dsa.rst``.
+The driver is implemented as a DSA driver, see Documentation/networking/dsa/dsa.rst.
See ``Documentation/devicetree/bindings/net/dsa/lan9303.txt`` for device tree
binding.
diff --git a/Documentation/process/adding-syscalls.rst b/Documentation/process/adding-syscalls.rst
index 906c47f1a9e5..5e6d26ef31eb 100644
--- a/Documentation/process/adding-syscalls.rst
+++ b/Documentation/process/adding-syscalls.rst
@@ -33,7 +33,7 @@ interface.
to a somewhat opaque API.
- If you're just exposing runtime system information, a new node in sysfs
- (see ``Documentation/filesystems/sysfs.rst``) or the ``/proc`` filesystem may
+ (see Documentation/filesystems/sysfs.rst) or the ``/proc`` filesystem may
be more appropriate. However, access to these mechanisms requires that the
relevant filesystem is mounted, which might not always be the case (e.g.
in a namespaced/sandboxed/chrooted environment). Avoid adding any API to
diff --git a/Documentation/process/submit-checklist.rst b/Documentation/process/submit-checklist.rst
index 7e6198ab368d..4c25fa07d1d5 100644
--- a/Documentation/process/submit-checklist.rst
+++ b/Documentation/process/submit-checklist.rst
@@ -43,7 +43,7 @@ and elsewhere regarding submitting Linux kernel patches.
6) Any new or modified ``CONFIG`` options do not muck up the config menu and
default to off unless they meet the exception criteria documented in
- ``Documentation/kbuild/kconfig-language.rst`` Menu attributes: default value.
+ Documentation/kbuild/kconfig-language.rst Menu attributes: default value.
7) All new ``Kconfig`` options have help text.
@@ -80,12 +80,12 @@ and elsewhere regarding submitting Linux kernel patches.
15) All new ``/proc`` entries are documented under ``Documentation/``
16) All new kernel boot parameters are documented in
- ``Documentation/admin-guide/kernel-parameters.rst``.
+ Documentation/admin-guide/kernel-parameters.rst.
17) All new module parameters are documented with ``MODULE_PARM_DESC()``
18) All new userspace interfaces are documented in ``Documentation/ABI/``.
- See ``Documentation/ABI/README.rst`` for more information.
+ See Documentation/ABI/README.rst for more information.
Patches that change userspace interfaces should be CCed to
linux-api@vger.kernel.org.
@@ -108,7 +108,7 @@ and elsewhere regarding submitting Linux kernel patches.
and why.
23) If any ioctl's are added by the patch, then also update
- ``Documentation/userspace-api/ioctl/ioctl-number.rst``.
+ Documentation/userspace-api/ioctl/ioctl-number.rst.
24) If your modified source code depends on or uses any of the kernel
APIs or features that are related to the following ``Kconfig`` symbols,
diff --git a/Documentation/security/keys/trusted-encrypted.rst b/Documentation/security/keys/trusted-encrypted.rst
index e989b9802f92..7ea1dc3956da 100644
--- a/Documentation/security/keys/trusted-encrypted.rst
+++ b/Documentation/security/keys/trusted-encrypted.rst
@@ -88,7 +88,7 @@ safe.
(2) TEE
TEEs have well-documented, standardized client interface and APIs. For
- more details refer to ``Documentation/driver-api/tee.rst``.
+ more details refer to Documentation/driver-api/tee.rst.
(3) CAAM
@@ -363,7 +363,7 @@ Other uses for trusted and encrypted keys, such as for disk and file encryption
are anticipated. In particular the new format 'ecryptfs' has been defined
in order to use encrypted keys to mount an eCryptfs filesystem. More details
about the usage can be found in the file
-``Documentation/security/keys/ecryptfs.rst``.
+Documentation/security/keys/ecryptfs.rst.
Another new format 'enc32' has been defined in order to support encrypted keys
with payload size of 32 bytes. This will initially be used for nvdimm security
diff --git a/Documentation/sound/kernel-api/writing-an-alsa-driver.rst b/Documentation/sound/kernel-api/writing-an-alsa-driver.rst
index cd421856409e..cf64e1c10ce8 100644
--- a/Documentation/sound/kernel-api/writing-an-alsa-driver.rst
+++ b/Documentation/sound/kernel-api/writing-an-alsa-driver.rst
@@ -2466,7 +2466,7 @@ Mic boost
Mic-boost switch is set as “Mic Boost” or “Mic Boost (6dB)”.
More precise information can be found in
-``Documentation/sound/designs/control-names.rst``.
+Documentation/sound/designs/control-names.rst.
Access Flags
------------
diff --git a/Documentation/translations/it_IT/doc-guide/sphinx.rst b/Documentation/translations/it_IT/doc-guide/sphinx.rst
index 1f513bc33618..f5b2140921a8 100644
--- a/Documentation/translations/it_IT/doc-guide/sphinx.rst
+++ b/Documentation/translations/it_IT/doc-guide/sphinx.rst
@@ -184,7 +184,7 @@ Aggiungere nuova documentazione è semplice:
1. aggiungete un file ``.rst`` nella sottocartella ``Documentation``
2. aggiungete un riferimento ad esso nell'indice (`TOC tree`_) in
- ``Documentation/index.rst``.
+ Documentation/index.rst.
.. _TOC tree: http://www.sphinx-doc.org/en/stable/markup/toctree.html
diff --git a/Documentation/translations/it_IT/kernel-hacking/hacking.rst b/Documentation/translations/it_IT/kernel-hacking/hacking.rst
index dd06bfc1a050..2b8ecc4b2098 100644
--- a/Documentation/translations/it_IT/kernel-hacking/hacking.rst
+++ b/Documentation/translations/it_IT/kernel-hacking/hacking.rst
@@ -771,7 +771,7 @@ anche per avere patch pulite, c'è del lavoro amministrativo da fare:
- Solitamente vorrete un'opzione di configurazione per la vostra modifica
al kernel. Modificate ``Kconfig`` nella cartella giusta. Il linguaggio
Config è facile con copia ed incolla, e c'è una completa documentazione
- nel file ``Documentation/kbuild/kconfig-language.rst``.
+ nel file Documentation/kbuild/kconfig-language.rst.
Nella descrizione della vostra opzione, assicuratevi di parlare sia agli
utenti esperti sia agli utente che non sanno nulla del vostro lavoro.
@@ -783,7 +783,7 @@ anche per avere patch pulite, c'è del lavoro amministrativo da fare:
- Modificate il file ``Makefile``: le variabili CONFIG sono esportate qui,
quindi potete solitamente aggiungere una riga come la seguete
"obj-$(CONFIG_xxx) += xxx.o". La sintassi è documentata nel file
- ``Documentation/kbuild/makefiles.rst``.
+ Documentation/kbuild/makefiles.rst.
- Aggiungete voi stessi in ``CREDITS`` se credete di aver fatto qualcosa di
notevole, solitamente qualcosa che supera il singolo file (comunque il vostro
@@ -793,7 +793,7 @@ anche per avere patch pulite, c'è del lavoro amministrativo da fare:
semplice impegno su una parte del codice.
- Infine, non dimenticatevi di leggere
- ``Documentation/process/submitting-patches.rst``.
+ Documentation/process/submitting-patches.rst.
Trucchetti del kernel
=====================
diff --git a/Documentation/translations/it_IT/kernel-hacking/locking.rst b/Documentation/translations/it_IT/kernel-hacking/locking.rst
index 4c21cf60f775..ab0fa1826f95 100644
--- a/Documentation/translations/it_IT/kernel-hacking/locking.rst
+++ b/Documentation/translations/it_IT/kernel-hacking/locking.rst
@@ -1409,7 +1409,7 @@ Riferimento per l'API dei Futex
Approfondimenti
===============
-- ``Documentation/locking/spinlocks.rst``: la guida di Linus Torvalds agli
+- Documentation/locking/spinlocks.rst: la guida di Linus Torvalds agli
spinlock del kernel.
- Unix Systems for Modern Architectures: Symmetric Multiprocessing and
diff --git a/Documentation/translations/it_IT/process/adding-syscalls.rst b/Documentation/translations/it_IT/process/adding-syscalls.rst
index df8c652d004b..55e511050847 100644
--- a/Documentation/translations/it_IT/process/adding-syscalls.rst
+++ b/Documentation/translations/it_IT/process/adding-syscalls.rst
@@ -39,7 +39,7 @@ vostra interfaccia.
un qualche modo opaca.
- Se dovete esporre solo delle informazioni sul sistema, un nuovo nodo in
- sysfs (vedere ``Documentation/filesystems/sysfs.rst``) o
+ sysfs (vedere Documentation/filesystems/sysfs.rst) o
in procfs potrebbe essere sufficiente. Tuttavia, l'accesso a questi
meccanismi richiede che il filesystem sia montato, il che potrebbe non
essere sempre vero (per esempio, in ambienti come namespace/sandbox/chroot).
diff --git a/Documentation/translations/it_IT/process/submit-checklist.rst b/Documentation/translations/it_IT/process/submit-checklist.rst
index 828c8f27d492..770e5601adc2 100644
--- a/Documentation/translations/it_IT/process/submit-checklist.rst
+++ b/Documentation/translations/it_IT/process/submit-checklist.rst
@@ -47,7 +47,7 @@ sottomissione delle patch, in particolare
6) Le opzioni ``CONFIG``, nuove o modificate, non scombussolano il menu
di configurazione e sono preimpostate come disabilitate a meno che non
- soddisfino i criteri descritti in ``Documentation/kbuild/kconfig-language.rst``
+ soddisfino i criteri descritti in Documentation/kbuild/kconfig-language.rst
alla punto "Voci di menu: valori predefiniti".
7) Tutte le nuove opzioni ``Kconfig`` hanno un messaggio di aiuto.
@@ -89,12 +89,12 @@ sottomissione delle patch, in particolare
16) Tutti i nuovi elementi in ``/proc`` sono documentati in ``Documentation/``.
17) Tutti i nuovi parametri d'avvio del kernel sono documentati in
- ``Documentation/admin-guide/kernel-parameters.rst``.
+ Documentation/admin-guide/kernel-parameters.rst.
18) Tutti i nuovi parametri dei moduli sono documentati con ``MODULE_PARM_DESC()``.
19) Tutte le nuove interfacce verso lo spazio utente sono documentate in
- ``Documentation/ABI/``. Leggete ``Documentation/ABI/README.rst`` per maggiori
+ ``Documentation/ABI/``. Leggete Documentation/ABI/README.rst per maggiori
informazioni. Le patch che modificano le interfacce utente dovrebbero
essere inviate in copia anche a linux-api@vger.kernel.org.
@@ -118,7 +118,7 @@ sottomissione delle patch, in particolare
sorgenti che ne spieghi la logica: cosa fanno e perché.
24) Se la patch aggiunge nuove chiamate ioctl, allora aggiornate
- ``Documentation/userspace-api/ioctl/ioctl-number.rst``.
+ Documentation/userspace-api/ioctl/ioctl-number.rst.
25) Se il codice che avete modificato dipende o usa una qualsiasi interfaccia o
funzionalità del kernel che è associata a uno dei seguenti simboli
diff --git a/Documentation/translations/sp_SP/process/adding-syscalls.rst b/Documentation/translations/sp_SP/process/adding-syscalls.rst
index f21504c612b2..f143d4eea5eb 100644
--- a/Documentation/translations/sp_SP/process/adding-syscalls.rst
+++ b/Documentation/translations/sp_SP/process/adding-syscalls.rst
@@ -39,7 +39,7 @@ a su interfaz.
API algo opaca.
- Si sólo está exponiendo información del runtime, un nuevo nodo en sysfs
- (mire ``Documentation/filesystems/sysfs.rst``) o el filesystem ``/proc``
+ (mire Documentation/filesystems/sysfs.rst) o el filesystem ``/proc``
podría ser más adecuado. Sin embargo, acceder a estos mecanismos
requiere que el filesystem relevante esté montado, lo que podría no ser
siempre el caso (e.g. en un ambiente namespaced/sandboxed/chrooted).
diff --git a/Documentation/translations/sp_SP/process/submit-checklist.rst b/Documentation/translations/sp_SP/process/submit-checklist.rst
index b8072be18532..d79b0e7b478d 100644
--- a/Documentation/translations/sp_SP/process/submit-checklist.rst
+++ b/Documentation/translations/sp_SP/process/submit-checklist.rst
@@ -51,7 +51,7 @@ y en otros lugares con respecto al envío de parches del kernel de Linux.
6) Cualquier opción ``CONFIG`` nueva o modificada no altera el menú de
configuración y se desactiva por defecto, a menos que cumpla con los
criterios de excepción documentados en
- ``Documentation/kbuild/kconfig-language.rst`` Atributos del menú: valor por defecto.
+ Documentation/kbuild/kconfig-language.rst Atributos del menú: valor por defecto.
7) Todas las nuevas opciones de ``Kconfig`` tienen texto de ayuda.
@@ -91,13 +91,13 @@ y en otros lugares con respecto al envío de parches del kernel de Linux.
``Documentation/``.
16) Todos los nuevos parámetros de arranque del kernel están documentados
- en ``Documentation/admin-guide/kernel-parameters.rst``.
+ en Documentation/admin-guide/kernel-parameters.rst.
17) Todos los nuevos parámetros del módulo están documentados con
``MODULE_PARM_DESC()``.
18) Todas las nuevas interfaces de espacio de usuario están documentadas
- en ``Documentation/ABI/``. Consulte ``Documentation/ABI/README.rst`` para
+ en ``Documentation/ABI/``. Consulte Documentation/ABI/README.rst para
obtener más información. Los parches que cambian las interfaces del
espacio de usuario deben ser CCed a linux-api@vger.kernel.org.
@@ -120,7 +120,7 @@ y en otros lugares con respecto al envío de parches del kernel de Linux.
la lógica de lo que están haciendo y por qué.
23) Si se añaden algún ioctl en el parche, actualice también
- ``Documentation/userspace-api/ioctl/ioctl-number.rst``.
+ Documentation/userspace-api/ioctl/ioctl-number.rst.
24) Si su código fuente modificado depende o utiliza cualquiera de las
API o características del kernel que están relacionadas con los
diff --git a/Documentation/translations/zh_CN/doc-guide/sphinx.rst b/Documentation/translations/zh_CN/doc-guide/sphinx.rst
index 23eac67fbc30..b24fbdde4e0d 100644
--- a/Documentation/translations/zh_CN/doc-guide/sphinx.rst
+++ b/Documentation/translations/zh_CN/doc-guide/sphinx.rst
@@ -134,7 +134,7 @@ Sphinx构建
添加新文档很容易,只需:
1. 在 ``Documentation`` 下某处添加一个新的 ``.rst`` 文件。
-2. 从 ``Documentation/index.rst`` 中的Sphinx `主目录树`_ 链接到它。
+2. 从 Documentation/index.rst 中的Sphinx `主目录树`_ 链接到它。
.. _主目录树: http://www.sphinx-doc.org/en/stable/markup/toctree.html
diff --git a/Documentation/translations/zh_CN/process/submit-checklist.rst b/Documentation/translations/zh_CN/process/submit-checklist.rst
index 0942021202a3..50c2f31906dd 100644
--- a/Documentation/translations/zh_CN/process/submit-checklist.rst
+++ b/Documentation/translations/zh_CN/process/submit-checklist.rst
@@ -42,7 +42,7 @@ Linux内核补丁提交检查单
违规行为。
6) 任何新的或修改过的 ``CONFIG`` 选项都不应搞乱配置菜单,并默认为关闭,除非
- 它们符合 ``Documentation/kbuild/kconfig-language.rst`` 菜单属性:默认值中
+ 它们符合 Documentation/kbuild/kconfig-language.rst 菜单属性:默认值中
记录的例外条件。
7) 所有新的 ``kconfig`` 选项都有帮助文本。
@@ -83,7 +83,7 @@ Linux内核补丁提交检查单
17) 所有新的模块参数都记录在 ``MODULE_PARM_DESC()``
18) 所有新的用户空间接口都记录在 ``Documentation/ABI/`` 中。有关详细信息,
- 请参阅 ``Documentation/ABI/README.rst`` 。更改用户空间接口的补丁应该抄送
+ 请参阅 Documentation/ABI/README.rst 。更改用户空间接口的补丁应该抄送
linux-api@vger.kernel.org。
19) 已通过至少注入slab和page分配失败进行检查。请参阅 ``Documentation/fault-injection/`` 。
@@ -100,7 +100,7 @@ Linux内核补丁提交检查单
释来解释它们正在执行的操作及其原因的逻辑。
23) 如果补丁添加了任何ioctl,那么也要更新
- ``Documentation/userspace-api/ioctl/ioctl-number.rst`` 。
+ Documentation/userspace-api/ioctl/ioctl-number.rst 。
24) 如果修改后的源代码依赖或使用与以下 ``Kconfig`` 符号相关的任何内核API或
功能,则在禁用相关 ``Kconfig`` 符号和/或 ``=m`` (如果该选项可用)的情况
diff --git a/Documentation/translations/zh_TW/process/submit-checklist.rst b/Documentation/translations/zh_TW/process/submit-checklist.rst
index efece58cb5b2..560bb30ac0f7 100644
--- a/Documentation/translations/zh_TW/process/submit-checklist.rst
+++ b/Documentation/translations/zh_TW/process/submit-checklist.rst
@@ -45,7 +45,7 @@ Linux內核補丁提交檢查單
違規行爲。
6) 任何新的或修改過的 ``CONFIG`` 選項都不應搞亂配置菜單,並默認爲關閉,除非
- 它們符合 ``Documentation/kbuild/kconfig-language.rst`` 菜單屬性:默認值中
+ 它們符合 Documentation/kbuild/kconfig-language.rst 菜單屬性:默認值中
記錄的例外條件。
7) 所有新的 ``kconfig`` 選項都有幫助文本。
@@ -86,7 +86,7 @@ Linux內核補丁提交檢查單
17) 所有新的模塊參數都記錄在 ``MODULE_PARM_DESC()``
18) 所有新的用戶空間接口都記錄在 ``Documentation/ABI/`` 中。有關詳細信息,
- 請參閱 ``Documentation/ABI/README.rst`` 。更改用戶空間接口的補丁應該抄送
+ 請參閱 Documentation/ABI/README.rst 。更改用戶空間接口的補丁應該抄送
linux-api@vger.kernel.org。
19) 已通過至少注入slab和page分配失敗進行檢查。請參閱 ``Documentation/fault-injection/`` 。
@@ -103,7 +103,7 @@ Linux內核補丁提交檢查單
釋來解釋它們正在執行的操作及其原因的邏輯。
23) 如果補丁添加了任何ioctl,那麼也要更新
- ``Documentation/userspace-api/ioctl/ioctl-number.rst`` 。
+ Documentation/userspace-api/ioctl/ioctl-number.rst 。
24) 如果修改後的源代碼依賴或使用與以下 ``Kconfig`` 符號相關的任何內核API或
功能,則在禁用相關 ``Kconfig`` 符號和/或 ``=m`` (如果該選項可用)的情況
diff --git a/Documentation/userspace-api/media/v4l/dev-sliced-vbi.rst b/Documentation/userspace-api/media/v4l/dev-sliced-vbi.rst
index 42cdb0a9f786..6e796775c740 100644
--- a/Documentation/userspace-api/media/v4l/dev-sliced-vbi.rst
+++ b/Documentation/userspace-api/media/v4l/dev-sliced-vbi.rst
@@ -430,7 +430,7 @@ MPEG stream.
*Historical context*: This format specification originates from a
custom, embedded, sliced VBI data format used by the ``ivtv`` driver.
This format has already been informally specified in the kernel sources
-in the file ``Documentation/userspace-api/media/drivers/cx2341x-uapi.rst`` . The
+in the file Documentation/userspace-api/media/drivers/cx2341x-uapi.rst . The
maximum size of the payload and other aspects of this format are driven
by the CX23415 MPEG decoder's capabilities and limitations with respect
to extracting, decoding, and displaying sliced VBI data embedded within
diff --git a/Documentation/userspace-api/media/v4l/diff-v4l.rst b/Documentation/userspace-api/media/v4l/diff-v4l.rst
index 33243ecb5033..b087835a147f 100644
--- a/Documentation/userspace-api/media/v4l/diff-v4l.rst
+++ b/Documentation/userspace-api/media/v4l/diff-v4l.rst
@@ -634,7 +634,7 @@ devices is documented in :ref:`extended-controls`.
compatible with V4L or V4L2.
.. [#f2]
- According to ``Documentation/admin-guide/devices.rst`` a symbolic link to
+ According to Documentation/admin-guide/devices.rst a symbolic link to
``/dev/radio0``.
.. [#f3]
diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
index 2a165ae063fb..957c8a54fbfc 100644
--- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
+++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
@@ -109,7 +109,7 @@ enum v4l2_mpeg_stream_vbi_fmt -
* - ``V4L2_MPEG_STREAM_VBI_FMT_IVTV``
- VBI in private packets, IVTV format (documented in the kernel
sources in the file
- ``Documentation/userspace-api/media/drivers/cx2341x-uapi.rst``)
+ Documentation/userspace-api/media/drivers/cx2341x-uapi.rst)
diff --git a/Documentation/virt/uml/user_mode_linux_howto_v2.rst b/Documentation/virt/uml/user_mode_linux_howto_v2.rst
index d1cfe415e4c4..d7959b081458 100644
--- a/Documentation/virt/uml/user_mode_linux_howto_v2.rst
+++ b/Documentation/virt/uml/user_mode_linux_howto_v2.rst
@@ -1083,7 +1083,7 @@ new feature, please send it to ``linux-um@lists.infradead.org``.
Please follow all standard Linux patch guidelines such as cc-ing
relevant maintainers and run ``./scripts/checkpatch.pl`` on your patch.
-For more details see ``Documentation/process/submitting-patches.rst``
+For more details see Documentation/process/submitting-patches.rst
Note - the list does not accept HTML or attachments, all emails must
be formatted as plain text.
--
2.34.1
^ permalink raw reply related
* Re: [PATCH v5] posix-timers: add multi_clock_gettime system call
From: Thomas Gleixner @ 2024-01-08 11:09 UTC (permalink / raw)
To: Sagi Maimon, richardcochran, luto, datglx, mingo, bp, dave.hansen,
x86, hpa, arnd, geert, peterz, hannes, sohil.mehta,
rick.p.edgecombe, nphamcs, palmer, maimon.sagi, keescook, legion,
mark.rutland
Cc: linux-kernel, linux-api, linux-arch, netdev
In-Reply-To: <20240102091855.70418-1-maimon.sagi@gmail.com>
On Tue, Jan 02 2024 at 11:18, Sagi Maimon wrote:
> Some user space applications need to read some clocks.
> Each read requires moving from user space to kernel space.
> The syscall overhead causes unpredictable delay between N clocks reads
> Removing this delay causes better synchronization between N clocks.
As I explained to you before: This is wishful thinking.
There is absolutely no guarantee that the syscall will yield better
results. It might on average, but that's a useless measure.
You also still fail to explain what this is going to solve and how it's
used.
> Some user space applications need to read some clocks.
Is just not an explanation at all.
Thanks,
tglx
^ permalink raw reply
* Re: [PATCH v5 02/11] mm/mempolicy: introduce MPOL_WEIGHTED_INTERLEAVE for weighted interleaving
From: Huang, Ying @ 2024-01-08 7:08 UTC (permalink / raw)
To: Gregory Price
Cc: Gregory Price, linux-mm, linux-doc, linux-fsdevel, linux-kernel,
linux-api, x86, akpm, arnd, tglx, luto, mingo, bp, dave.hansen,
hpa, mhocko, tj, corbet, rakie.kim, hyeongtak.ji, honggyu.kim,
vtavarespetr, peterz, jgroves, ravis.opensrc, sthanneeru,
emirakhur, Hasan.Maruf, seungjun.ha, Srinivasulu Thanneeru
In-Reply-To: <ZZeu6DwVt6o0fl14@memverge.com>
Gregory Price <gregory.price@memverge.com> writes:
> On Fri, Jan 05, 2024 at 02:51:40PM +0800, Huang, Ying wrote:
>> >
>> > So we're talking ~1MB for 1024 threads with mempolicies to avoid error
>> > conditions mid-page-allocation and to reduce the cost associated with
>> > applying weighted interleave.
>>
>> Think about this again. Why do we need weights array on stack? I think
>> this is used to keep weights consistent. If so, we don't need weights
>> array on stack. Just use RCU to access global weights array.
>>
>
> From the bulk allocation code:
>
> __alloc_pages_bulk(gfp, node, NULL, node_pages, NULL, page_array);
>
> This function can block. You cannot block during an RCU read context.
Yes. You are right. For __alloc_pages_bulk(), it should be OK to
allocate the weights array. For weighted_interleave_nid(), we can use
RCU to avoid memory allocation in relative fast code path.
BTW, we can use nr_node_ids instead of MAX_NUMNODES if applicable.
--
Best Regards,
Huang, Ying
^ permalink raw reply
* Re: [PATCH v3] posix-timers: add multi_clock_gettime system call
From: Sagi Maimon @ 2024-01-07 14:05 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Richard Cochran, Andy Lutomirski, datglx, Ingo Molnar,
Borislav Petkov, Dave Hansen, x86, H. Peter Anvin,
Geert Uytterhoeven, Peter Zijlstra, Johannes Weiner, Sohil Mehta,
Rick Edgecombe, Nhat Pham, Palmer Dabbelt, Kees Cook,
Alexey Gladkov, Mark Rutland, linux-kernel, linux-api, Linux-Arch,
Netdev
In-Reply-To: <84d8e9d7-09ce-4781-8dfa-a74bb0955ae8@app.fastmail.com>
On Tue, Jan 2, 2024 at 1:30 PM Arnd Bergmann <arnd@arndb.de> wrote:
>
> On Sun, Dec 31, 2023, at 17:00, Sagi Maimon wrote:
> > On Fri, Dec 29, 2023 at 5:27 PM Arnd Bergmann <arnd@arndb.de> wrote:
>
> >> > +struct __ptp_multi_clock_get {
> >> > + unsigned int n_clocks; /* Desired number of clocks. */
> >> > + unsigned int n_samples; /* Desired number of measurements per clock. */
> >> > + clockid_t clkid_arr[MULTI_PTP_MAX_CLOCKS]; /* list of clock IDs */
> >> > + /*
> >> > + * Array of list of n_clocks clocks time samples n_samples times.
> >> > + */
> >> > + struct __kernel_timespec ts[MULTI_PTP_MAX_SAMPLES][MULTI_PTP_MAX_CLOCKS];
> >> > +};
> >>
> >> The fixed size arrays here seem to be an unnecessary limitation,
> >> both MULTI_PTP_MAX_SAMPLES and MULTI_PTP_MAX_CLOCKS are small
> >> enough that one can come up with scenarios where you would want
> >> a higher number, but at the same time the structure is already
> >> 808 bytes long, which is more than you'd normally want to put
> >> on the kernel stack, and which may take a significant time to
> >> copy to and from userspace.
> >>
> >> Since n_clocks and n_samples are always inputs to the syscall,
> >> you can just pass them as register arguments and use a dynamically
> >> sized array instead.
> >>
> > Both MULTI_PTP_MAX_SAMPLES and MULTI_PTP_MAX_CLOCKS are enough of any
> > usage we can think of,
> > But I think you are right, it is better to use a dynamically sized
> > array for future use, plus to use less stack memory.
> > On patch v4 a dynamically sized array will be used .
> > I leaving both MULTI_PTP_MAX_SAMPLES and MULTI_PTP_MAX_CLOCKS but
> > increasing their values, since there should be some limitation.
>
> I think having an implementation specific limit in the kernel is
> fine, but it would be nice to hardcode that limit in the API.
>
> If both clkidarr[] and ts[] are passed as pointer arguments
> in registers, they can be arbitrarily long in the API and
> still have a documented maximum that we can extend in the
> future without changing the interface.
>
> >> It's not clear to me what you gain from having the n_samples
> >> argument over just calling the syscall repeatedly. Does
> >> this offer a benefit for accuracy or is this just meant to
> >> avoid syscall overhead.
> > It is mainly to avoid syscall overhead which also slightly
> > improve the accuracy.
>
> This is not a big deal as far as I'm concerned, but it
> would be nice to back this up with some numbers if you
> think it's worthwhile, as my impression is that the effect
> is barely measurable: my guess would be that the syscall
> overhead is always much less than the cost for the hardware
> access.
>
> >> On the other hand, this will still give less accuracy than the
> >> getcrosststamp() callback with ioctl(PTP_SYS_OFFSET_PRECISE),
> >> so either the last bit of accuracy isn't all that important,
> >> or you need to refine the interface to actually be an
> >> improvement over the chardev.
> >>
> > I don't understand this comment, please explain.
> > The ioctl(PTP_SYS_OFFSET_PRECISE) is one specific case that can be
> > done by multi_clock_gettime syscall (which cover many more cases)
> > Plus the ioctl(PTP_SYS_OFFSET_PRECISE) works only on drivers that
> > support this feature.
>
> My point here is that on drivers that do support
> PTP_SYS_OFFSET_PRECISE, the extra accuracy should be maintained
> by the new interface, ideally in a way that does not have any
> other downsides.
>
> I think Andy's suggestion of exposing time offsets instead
> of absolute times would actually achieve that: If the
> interface is changed to return the offset against
> CLOCK_MONOTONIC, CLOCK_MONOTONIC_RAW or CLOCK_BOOTTIME
> (not sure what is best here), then the new syscall can use
> getcrosststamp() where supported for the best results or
> fall back to gettimex64() or gettime64() otherwise to
> provide a consistent user interface.
>
> Returning an offset would also allow easily calculating an
> average over multiple calls in the kernel, instead of
> returning a two-dimensional array.
>
PTP_SYS_OFFSET_PRECISE returns the systime and PHC time and not offset.
But you are right , in the next patch I will use this IOCTL .
> Arnd
^ permalink raw reply
* Re: [PATCH 1/5] docs: move admin-guide/sysfs-rules.rst to userspace-api/
From: Mauro Carvalho Chehab @ 2024-01-05 20:25 UTC (permalink / raw)
To: Vegard Nossum
Cc: Jonathan Corbet, Randy Dunlap, Greg Kroah-Hartman, Jani Nikula,
linux-doc, linux-api
In-Reply-To: <20240104160946.3450743-1-vegard.nossum@oracle.com>
Em Thu, 4 Jan 2024 17:09:42 +0100
Vegard Nossum <vegard.nossum@oracle.com> escreveu:
> This file documents how userspace ought to interact with sysfs. It is
> clearly intended for applications that access sysfs programmatically,
> rather than at users or admins.
>
> Move it to the userspace API guide.
Hmm... this is both uAPI and admin stuff, as sysfs nodes can be used
directly on scripts written by sysadmin.
Perhaps we should add a link from one book to the other one, specially
if we move it to uAPI guide.
Regards,
Mauro
>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
> ---
> Documentation/ABI/stable/sysfs-devices | 2 +-
> Documentation/admin-guide/index.rst | 9 ---------
> Documentation/userspace-api/index.rst | 10 +++++++++-
> .../{admin-guide => userspace-api}/sysfs-rules.rst | 0
> tools/lib/api/fs/fs.c | 2 +-
> 5 files changed, 11 insertions(+), 12 deletions(-)
> rename Documentation/{admin-guide => userspace-api}/sysfs-rules.rst (100%)
>
> diff --git a/Documentation/ABI/stable/sysfs-devices b/Documentation/ABI/stable/sysfs-devices
> index 98a8ef99ac5f..7829414cba62 100644
> --- a/Documentation/ABI/stable/sysfs-devices
> +++ b/Documentation/ABI/stable/sysfs-devices
> @@ -1,6 +1,6 @@
> Note:
> This documents additional properties of any device beyond what
> - is documented in Documentation/admin-guide/sysfs-rules.rst
> + is documented in Documentation/userspace-api/sysfs-rules.rst
>
> What: /sys/devices/*/of_node
> Date: February 2015
> diff --git a/Documentation/admin-guide/index.rst b/Documentation/admin-guide/index.rst
> index 43ea35613dfc..c2b032314a24 100644
> --- a/Documentation/admin-guide/index.rst
> +++ b/Documentation/admin-guide/index.rst
> @@ -47,15 +47,6 @@ problems and bugs in particular.
> perf/index
> pstore-blk
>
> -This is the beginning of a section with information of interest to
> -application developers. Documents covering various aspects of the kernel
> -ABI will be found here.
> -
> -.. toctree::
> - :maxdepth: 1
> -
> - sysfs-rules
> -
> This is the beginning of a section with information of interest to
> application developers and system integrators doing analysis of the
> Linux kernel for safety critical applications. Documents supporting
> diff --git a/Documentation/userspace-api/index.rst b/Documentation/userspace-api/index.rst
> index 74bc0716432e..6ce2edf519f6 100644
> --- a/Documentation/userspace-api/index.rst
> +++ b/Documentation/userspace-api/index.rst
> @@ -9,8 +9,16 @@ While much of the kernel's user-space API is documented elsewhere
> also be found in the kernel tree itself. This manual is intended to be the
> place where this information is gathered.
>
> +General documentation:
> +
> +.. toctree::
> + :maxdepth: 1
> +
> + sysfs-rules
> +
> +Subsystem-specific documentation:
> +
> .. toctree::
> - :caption: Table of contents
> :maxdepth: 2
>
> no_new_privs
> diff --git a/Documentation/admin-guide/sysfs-rules.rst b/Documentation/userspace-api/sysfs-rules.rst
> similarity index 100%
> rename from Documentation/admin-guide/sysfs-rules.rst
> rename to Documentation/userspace-api/sysfs-rules.rst
> diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
> index 5cb0eeec2c8a..c35247b6ad81 100644
> --- a/tools/lib/api/fs/fs.c
> +++ b/tools/lib/api/fs/fs.c
> @@ -214,7 +214,7 @@ static void mem_toupper(char *f, size_t len)
>
> /*
> * Check for "NAME_PATH" environment variable to override fs location (for
> - * testing). This matches the recommendation in Documentation/admin-guide/sysfs-rules.rst
> + * testing). This matches the recommendation in Documentation/userspace-api/sysfs-rules.rst
> * for SYSFS_PATH.
> */
> static bool fs__env_override(struct fs *fs)
Thanks,
Mauro
^ permalink raw reply
* Re: [PATCH 4/5] Documentation/ABI/README: convert to ReST
From: Mauro Carvalho Chehab @ 2024-01-05 20:07 UTC (permalink / raw)
To: Vegard Nossum
Cc: Jonathan Corbet, Randy Dunlap, Greg Kroah-Hartman, Jani Nikula,
linux-doc, linux-api
In-Reply-To: <20240104160946.3450743-4-vegard.nossum@oracle.com>
Em Thu, 4 Jan 2024 17:09:45 +0100
Vegard Nossum <vegard.nossum@oracle.com> escreveu:
> This file is basically ReST syntax already -- with just a few tweaks we
> can include this in the rendered HTML documentation which currently has
> no introduction or explanation.
>
> References to this document were found and fixed with some variant of:
>
> git grep -Pl 'ABI/README(?!\.rst)' | xargs sed -i 's|\(Documentation/ABI/README\)|\1\.rst|g'
>
> plus manual inspection and reflows where necessary.
>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
> ---
> Documentation/ABI/{README => README.rst} | 36 +++++++++----------
> Documentation/Kconfig | 8 ++---
> Documentation/filesystems/sysfs.rst | 4 +--
> Documentation/process/4.Coding.rst | 4 +--
> Documentation/process/submit-checklist.rst | 2 +-
> .../translations/it_IT/process/4.Coding.rst | 4 +--
> .../it_IT/process/submit-checklist.rst | 2 +-
> .../translations/ja_JP/SubmitChecklist | 2 +-
> .../sp_SP/process/submit-checklist.rst | 2 +-
> .../translations/zh_CN/filesystems/sysfs.txt | 2 +-
> .../translations/zh_CN/process/4.Coding.rst | 2 +-
> .../zh_CN/process/submit-checklist.rst | 2 +-
> .../translations/zh_TW/filesystems/sysfs.txt | 2 +-
> .../translations/zh_TW/process/4.Coding.rst | 2 +-
> .../zh_TW/process/submit-checklist.rst | 2 +-
> 15 files changed, 38 insertions(+), 38 deletions(-)
> rename Documentation/ABI/{README => README.rst} (82%)
>
> diff --git a/Documentation/ABI/README b/Documentation/ABI/README.rst
> similarity index 82%
> rename from Documentation/ABI/README
> rename to Documentation/ABI/README.rst
> index 8bac9cb09a6d..04f5d05d6caa 100644
> --- a/Documentation/ABI/README
> +++ b/Documentation/ABI/README.rst
> @@ -41,24 +41,24 @@ The different levels of stability are:
> This directory contains a list of the old interfaces that have
> been removed from the kernel.
>
> -Every file in these directories will contain the following information:
> -
> -What: Short description of the interface
> -Date: Date created
> -KernelVersion: Kernel version this feature first showed up in.
> -Contact: Primary contact for this interface (may be a mailing list)
> -Description: Long description of the interface and how to use it.
> -Users: All users of this interface who wish to be notified when
> - it changes. This is very important for interfaces in
> - the "testing" stage, so that kernel developers can work
> - with userspace developers to ensure that things do not
> - break in ways that are unacceptable. It is also
> - important to get feedback for these interfaces to make
> - sure they are working in a proper way and do not need to
> - be changed further.
> -
> -
> -Note:
> +Every file in these directories will contain the following information::
> +
> + What: Short description of the interface
> + Date: Date created
> + KernelVersion: Kernel version this feature first showed up in.
> + Contact: Primary contact for this interface (may be a mailing list)
> + Description: Long description of the interface and how to use it.
> + Users: All users of this interface who wish to be notified when
> + it changes. This is very important for interfaces in
> + the "testing" stage, so that kernel developers can work
> + with userspace developers to ensure that things do not
> + break in ways that are unacceptable. It is also
> + important to get feedback for these interfaces to make
> + sure they are working in a proper way and do not need to
> + be changed further.
My personal preference would be to use:
:What:
as this produces a better markup.
> +
> +.. note::
> +
> The fields should be use a simple notation, compatible with ReST markup.
> Also, the file **should not** have a top-level index, like::
>
> diff --git a/Documentation/Kconfig b/Documentation/Kconfig
> index 3a0e7ac0c4e3..8e690a4f1a64 100644
> --- a/Documentation/Kconfig
> +++ b/Documentation/Kconfig
> @@ -16,10 +16,10 @@ config WARN_ABI_ERRORS
> bool "Warn if there are errors at ABI files"
> help
> The files under Documentation/ABI should follow what's
> - described at Documentation/ABI/README. Yet, as they're manually
> - written, it would be possible that some of those files would
> - have errors that would break them for being parsed by
> - scripts/get_abi.pl. Add a check to verify them.
> + described at Documentation/ABI/README.rst. Yet, as they're
> + manually written, it would be possible that some of those
> + files would have errors that would break them for being parsed
> + by scripts/get_abi.pl. Add a check to verify them.
>
> If unsure, select 'N'.
>
> diff --git a/Documentation/filesystems/sysfs.rst b/Documentation/filesystems/sysfs.rst
> index c32993bc83c7..e30694706b15 100644
> --- a/Documentation/filesystems/sysfs.rst
> +++ b/Documentation/filesystems/sysfs.rst
> @@ -418,5 +418,5 @@ Documentation
> The sysfs directory structure and the attributes in each directory define an
> ABI between the kernel and user space. As for any ABI, it is important that
> this ABI is stable and properly documented. All new sysfs attributes must be
> -documented in Documentation/ABI. See also Documentation/ABI/README for more
> -information.
> +documented in Documentation/ABI. See also Documentation/ABI/README.rst for
> +more information.
> diff --git a/Documentation/process/4.Coding.rst b/Documentation/process/4.Coding.rst
> index 1f0d81f44e14..120d126ee288 100644
> --- a/Documentation/process/4.Coding.rst
> +++ b/Documentation/process/4.Coding.rst
> @@ -347,8 +347,8 @@ information.
> Any code which adds a new user-space interface - including new sysfs or
> /proc files - should include documentation of that interface which enables
> user-space developers to know what they are working with. See
> -Documentation/ABI/README for a description of how this documentation should
> -be formatted and what information needs to be provided.
> +Documentation/ABI/README.rst for a description of how this documentation
> +should be formatted and what information needs to be provided.
>
> The file :ref:`Documentation/admin-guide/kernel-parameters.rst
> <kernelparameters>` describes all of the kernel's boot-time parameters.
> diff --git a/Documentation/process/submit-checklist.rst b/Documentation/process/submit-checklist.rst
> index b1bc2d37bd0a..7e6198ab368d 100644
> --- a/Documentation/process/submit-checklist.rst
> +++ b/Documentation/process/submit-checklist.rst
> @@ -85,7 +85,7 @@ and elsewhere regarding submitting Linux kernel patches.
> 17) All new module parameters are documented with ``MODULE_PARM_DESC()``
>
> 18) All new userspace interfaces are documented in ``Documentation/ABI/``.
> - See ``Documentation/ABI/README`` for more information.
> + See ``Documentation/ABI/README.rst`` for more information.
If you're willing to convert to ReST, please remove ``, as this will
let automarkup.py to create cross-reference links. Same note for the
translations too.
> Patches that change userspace interfaces should be CCed to
> linux-api@vger.kernel.org.
>
> diff --git a/Documentation/translations/it_IT/process/4.Coding.rst b/Documentation/translations/it_IT/process/4.Coding.rst
> index 54fd255b77d0..631d56ae56dc 100644
> --- a/Documentation/translations/it_IT/process/4.Coding.rst
> +++ b/Documentation/translations/it_IT/process/4.Coding.rst
> @@ -365,8 +365,8 @@ informazione.
> Qualsiasi codice che aggiunge una nuova interfaccia in spazio utente - inclusi
> nuovi file in sysfs o /proc - dovrebbe includere la documentazione di tale
> interfaccia così da permette agli sviluppatori dello spazio utente di sapere
> -con cosa stanno lavorando. Consultate: Documentation/ABI/README per avere una
> -descrizione di come questi documenti devono essere impostati e quali
> +con cosa stanno lavorando. Consultate: Documentation/ABI/README.rst per avere
> +una descrizione di come questi documenti devono essere impostati e quali
> informazioni devono essere fornite.
>
> Il file :ref:`Documentation/translations/it_IT/admin-guide/kernel-parameters.rst <kernelparameters>`
> diff --git a/Documentation/translations/it_IT/process/submit-checklist.rst b/Documentation/translations/it_IT/process/submit-checklist.rst
> index 2fc09cc1f0be..828c8f27d492 100644
> --- a/Documentation/translations/it_IT/process/submit-checklist.rst
> +++ b/Documentation/translations/it_IT/process/submit-checklist.rst
> @@ -94,7 +94,7 @@ sottomissione delle patch, in particolare
> 18) Tutti i nuovi parametri dei moduli sono documentati con ``MODULE_PARM_DESC()``.
>
> 19) Tutte le nuove interfacce verso lo spazio utente sono documentate in
> - ``Documentation/ABI/``. Leggete ``Documentation/ABI/README`` per maggiori
> + ``Documentation/ABI/``. Leggete ``Documentation/ABI/README.rst`` per maggiori
> informazioni. Le patch che modificano le interfacce utente dovrebbero
> essere inviate in copia anche a linux-api@vger.kernel.org.
>
> diff --git a/Documentation/translations/ja_JP/SubmitChecklist b/Documentation/translations/ja_JP/SubmitChecklist
> index 4429447b0965..87867c47bffd 100644
> --- a/Documentation/translations/ja_JP/SubmitChecklist
> +++ b/Documentation/translations/ja_JP/SubmitChecklist
> @@ -86,7 +86,7 @@ Linux カーネルパッチ投稿者向けチェックリスト
> 利用して必ずその説明を記述してください。
>
> 18: 新しいuserspaceインタフェースを作成した場合には、Documentation/ABI/ に
> - Documentation/ABI/README を参考にして必ずドキュメントを追加してください。
> + Documentation/ABI/README.rst を参考にして必ずドキュメントを追加してください。
>
> 19: 少なくともslabアロケーションとpageアロケーションに失敗した場合の
> 挙動について、fault-injectionを利用して確認してください。
> diff --git a/Documentation/translations/sp_SP/process/submit-checklist.rst b/Documentation/translations/sp_SP/process/submit-checklist.rst
> index 0d6651f9d871..b8072be18532 100644
> --- a/Documentation/translations/sp_SP/process/submit-checklist.rst
> +++ b/Documentation/translations/sp_SP/process/submit-checklist.rst
> @@ -97,7 +97,7 @@ y en otros lugares con respecto al envío de parches del kernel de Linux.
> ``MODULE_PARM_DESC()``.
>
> 18) Todas las nuevas interfaces de espacio de usuario están documentadas
> - en ``Documentation/ABI/``. Consulte ``Documentation/ABI/README`` para
> + en ``Documentation/ABI/``. Consulte ``Documentation/ABI/README.rst`` para
> obtener más información. Los parches que cambian las interfaces del
> espacio de usuario deben ser CCed a linux-api@vger.kernel.org.
>
> diff --git a/Documentation/translations/zh_CN/filesystems/sysfs.txt b/Documentation/translations/zh_CN/filesystems/sysfs.txt
> index 547062759e60..871fc60aeeca 100644
> --- a/Documentation/translations/zh_CN/filesystems/sysfs.txt
> +++ b/Documentation/translations/zh_CN/filesystems/sysfs.txt
> @@ -370,4 +370,4 @@ void driver_remove_file(struct device_driver *, const struct driver_attribute *)
>
> sysfs 目录结构以及其中包含的属性定义了一个内核与用户空间之间的 ABI。
> 对于任何 ABI,其自身的稳定和适当的文档是非常重要的。所有新的 sysfs
> -属性必须在 Documentation/ABI 中有文档。详见 Documentation/ABI/README。
> +属性必须在 Documentation/ABI 中有文档。详见 Documentation/ABI/README.rst。
> diff --git a/Documentation/translations/zh_CN/process/4.Coding.rst b/Documentation/translations/zh_CN/process/4.Coding.rst
> index 7cac9424f5d5..1b752b3bdc8c 100644
> --- a/Documentation/translations/zh_CN/process/4.Coding.rst
> +++ b/Documentation/translations/zh_CN/process/4.Coding.rst
> @@ -244,7 +244,7 @@ scripts/coccinelle目录下已经打包了相当多的内核“语义补丁”
>
> 任何添加新用户空间接口的代码——包括新的sysfs或/proc文件——都应该包含该接口
> 的文档,该文档使用户空间开发人员能够知道他们在使用什么。请参阅
> -Documentation/ABI/README,了解如何此文档格式以及需要提供哪些信息。
> +Documentation/ABI/README.rst,了解如何此文档格式以及需要提供哪些信息。
>
> 文档 :ref:`Documentation/admin-guide/kernel-parameters.rst <kernelparameters>`
> 描述了内核的所有引导时间参数。任何添加新参数的补丁都应该向该文档添加适当的
> diff --git a/Documentation/translations/zh_CN/process/submit-checklist.rst b/Documentation/translations/zh_CN/process/submit-checklist.rst
> index 3d6ee21c74ae..0942021202a3 100644
> --- a/Documentation/translations/zh_CN/process/submit-checklist.rst
> +++ b/Documentation/translations/zh_CN/process/submit-checklist.rst
> @@ -83,7 +83,7 @@ Linux内核补丁提交检查单
> 17) 所有新的模块参数都记录在 ``MODULE_PARM_DESC()``
>
> 18) 所有新的用户空间接口都记录在 ``Documentation/ABI/`` 中。有关详细信息,
> - 请参阅 ``Documentation/ABI/README`` 。更改用户空间接口的补丁应该抄送
> + 请参阅 ``Documentation/ABI/README.rst`` 。更改用户空间接口的补丁应该抄送
> linux-api@vger.kernel.org。
>
> 19) 已通过至少注入slab和page分配失败进行检查。请参阅 ``Documentation/fault-injection/`` 。
> diff --git a/Documentation/translations/zh_TW/filesystems/sysfs.txt b/Documentation/translations/zh_TW/filesystems/sysfs.txt
> index 978462d5fe14..a94e83dcb814 100644
> --- a/Documentation/translations/zh_TW/filesystems/sysfs.txt
> +++ b/Documentation/translations/zh_TW/filesystems/sysfs.txt
> @@ -373,5 +373,5 @@ void driver_remove_file(struct device_driver *, const struct driver_attribute *)
>
> sysfs 目錄結構以及其中包含的屬性定義了一個內核與用戶空間之間的 ABI。
> 對於任何 ABI,其自身的穩定和適當的文檔是非常重要的。所有新的 sysfs
> -屬性必須在 Documentation/ABI 中有文檔。詳見 Documentation/ABI/README。
> +屬性必須在 Documentation/ABI 中有文檔。詳見 Documentation/ABI/README.rst。
>
> diff --git a/Documentation/translations/zh_TW/process/4.Coding.rst b/Documentation/translations/zh_TW/process/4.Coding.rst
> index bdd2abe4daf4..541e09ae1440 100644
> --- a/Documentation/translations/zh_TW/process/4.Coding.rst
> +++ b/Documentation/translations/zh_TW/process/4.Coding.rst
> @@ -247,7 +247,7 @@ scripts/coccinelle目錄下已經打包了相當多的內核“語義補丁”
>
> 任何添加新用戶空間接口的代碼——包括新的sysfs或/proc文件——都應該包含該接口
> 的文檔,該文檔使用戶空間開發人員能夠知道他們在使用什麼。請參閱
> -Documentation/ABI/README,瞭解如何此文檔格式以及需要提供哪些信息。
> +Documentation/ABI/README.rst,瞭解如何此文檔格式以及需要提供哪些信息。
>
> 文檔 :ref:`Documentation/admin-guide/kernel-parameters.rst <kernelparameters>`
> 描述了內核的所有引導時間參數。任何添加新參數的補丁都應該向該文檔添加適當的
> diff --git a/Documentation/translations/zh_TW/process/submit-checklist.rst b/Documentation/translations/zh_TW/process/submit-checklist.rst
> index e57ef0f99e0c..efece58cb5b2 100644
> --- a/Documentation/translations/zh_TW/process/submit-checklist.rst
> +++ b/Documentation/translations/zh_TW/process/submit-checklist.rst
> @@ -86,7 +86,7 @@ Linux內核補丁提交檢查單
> 17) 所有新的模塊參數都記錄在 ``MODULE_PARM_DESC()``
>
> 18) 所有新的用戶空間接口都記錄在 ``Documentation/ABI/`` 中。有關詳細信息,
> - 請參閱 ``Documentation/ABI/README`` 。更改用戶空間接口的補丁應該抄送
> + 請參閱 ``Documentation/ABI/README.rst`` 。更改用戶空間接口的補丁應該抄送
> linux-api@vger.kernel.org。
>
> 19) 已通過至少注入slab和page分配失敗進行檢查。請參閱 ``Documentation/fault-injection/`` 。
Thanks,
Mauro
^ permalink raw reply
* Re: [PATCH v5 02/11] mm/mempolicy: introduce MPOL_WEIGHTED_INTERLEAVE for weighted interleaving
From: Gregory Price @ 2024-01-05 7:25 UTC (permalink / raw)
To: Huang, Ying
Cc: Gregory Price, linux-mm, linux-doc, linux-fsdevel, linux-kernel,
linux-api, x86, akpm, arnd, tglx, luto, mingo, bp, dave.hansen,
hpa, mhocko, tj, corbet, rakie.kim, hyeongtak.ji, honggyu.kim,
vtavarespetr, peterz, jgroves, ravis.opensrc, sthanneeru,
emirakhur, Hasan.Maruf, seungjun.ha, Srinivasulu Thanneeru
In-Reply-To: <87cyugb7cz.fsf@yhuang6-desk2.ccr.corp.intel.com>
On Fri, Jan 05, 2024 at 02:51:40PM +0800, Huang, Ying wrote:
> >
> > So we're talking ~1MB for 1024 threads with mempolicies to avoid error
> > conditions mid-page-allocation and to reduce the cost associated with
> > applying weighted interleave.
>
> Think about this again. Why do we need weights array on stack? I think
> this is used to keep weights consistent. If so, we don't need weights
> array on stack. Just use RCU to access global weights array.
>
From the bulk allocation code:
__alloc_pages_bulk(gfp, node, NULL, node_pages, NULL, page_array);
This function can block. You cannot block during an RCU read context.
~Gregory
^ permalink raw reply
* Re: [PATCH v5 02/11] mm/mempolicy: introduce MPOL_WEIGHTED_INTERLEAVE for weighted interleaving
From: Huang, Ying @ 2024-01-05 6:51 UTC (permalink / raw)
To: Gregory Price
Cc: Gregory Price, linux-mm, linux-doc, linux-fsdevel, linux-kernel,
linux-api, x86, akpm, arnd, tglx, luto, mingo, bp, dave.hansen,
hpa, mhocko, tj, corbet, rakie.kim, hyeongtak.ji, honggyu.kim,
vtavarespetr, peterz, jgroves, ravis.opensrc, sthanneeru,
emirakhur, Hasan.Maruf, seungjun.ha, Srinivasulu Thanneeru
In-Reply-To: <ZZcAF4zIpsVN3dLd@memverge.com>
Gregory Price <gregory.price@memverge.com> writes:
> On Thu, Jan 04, 2024 at 01:39:31PM +0800, Huang, Ying wrote:
>> Gregory Price <gregory.price@memverge.com> writes:
>>
>> > On Wed, Jan 03, 2024 at 01:46:56PM +0800, Huang, Ying wrote:
>> >> Gregory Price <gregory.price@memverge.com> writes:
>> >> > I'm specifically concerned about:
>> >> > weighted_interleave_nid
>> >> > alloc_pages_bulk_array_weighted_interleave
>> >> >
>> >> > I'm unsure whether kmalloc/kfree is safe (and non-offensive) in those
>> >> > contexts. If kmalloc/kfree is safe fine, this problem is trivial.
>> >> >
>> >> > If not, there is no good solution to this without pre-allocating a
>> >> > scratch area per-task.
>> >>
>> >> You need to audit whether it's safe for all callers. I guess that you
>> >> need to allocate pages after calling, so you can use the same GFP flags
>> >> here.
>> >>
>> >
>> > After picking away i realized that this code is usually going to get
>> > called during page fault handling - duh. So kmalloc is almost never
>> > safe (or can fail), and we it's nasty to try to handle those errors.
>>
>> Why not just OOM for allocation failure?
>>
>
> 2 notes:
>
> 1) callers of weighted_interleave_nid do not expect OOM conditions, they
> expect a node selection. On error, we would simply return the local
> numa node without indication of failure.
>
> 2) callers of alloc_pages_bulk_array_weighted_interleave receive the
> total number of pages allocated, and they are expected to detect
> pages allocated != pages requested, and then handle whether to
> OOM or simply retry (allocation may fail for a variety of reasons).
>
> By introducing an allocation into this area, if an allocation failure
> occurs, we would essentially need to silently squash it and return
> either local_node (interleave_nid) or return 0 (bulk allocator) and
> allow the allocation logic to handle any subsequent OOM condition.
>
> That felt less desirable than just allocating a scratch space up front
> in the mempolicy and avoiding the issue altogether.
>
>> > Instead of doing that, I simply chose to implement the scratch space
>> > in the mempolicy structure
>> >
>> > mempolicy->wil.scratch_weights[MAX_NUMNODES].
>> >
>> > We eat an extra 1kb of memory in the mempolicy, but it gives us a safe
>> > scratch space we can use any time the task is allocating memory, and
>> > prevents the need for any fancy error handling. That seems like a
>> > perfectly reasonable tradeoff.
>>
>> I don't think that this is a good idea. The weight array is temporary.
>>
>
> It's temporary, but it's also only used in the context of the task while
> the alloc lock is held.
>
> If you think it's fine to introduce another potential OOM generating
> spot, then I'll just go ahead and allocate the memory on the fly.
>
> I do want to point out, though, that weighted_interleave_nid is called
> per allocated page. So now we're not just collecting weights to
> calculate the offset, we're doing an allocation (that can fail) per page
> allocated for that region.
>
> The bulk allocator amortizes the cost of this allocation by doing it
> once while allocating a chunk of pages - but the weighted_interleave_nid
> function is called per-page.
>
> By comparison, the memory cost to just allocate a static scratch area in
> the mempolicy struct is only incurred by tasks with a mempolicy.
>
>
> So we're talking ~1MB for 1024 threads with mempolicies to avoid error
> conditions mid-page-allocation and to reduce the cost associated with
> applying weighted interleave.
Think about this again. Why do we need weights array on stack? I think
this is used to keep weights consistent. If so, we don't need weights
array on stack. Just use RCU to access global weights array.
--
Best Regards,
Huang, Ying
^ permalink raw reply
* Re: [PATCH v5 02/11] mm/mempolicy: introduce MPOL_WEIGHTED_INTERLEAVE for weighted interleaving
From: Gregory Price @ 2024-01-04 18:59 UTC (permalink / raw)
To: Huang, Ying
Cc: Gregory Price, linux-mm, linux-doc, linux-fsdevel, linux-kernel,
linux-api, x86, akpm, arnd, tglx, luto, mingo, bp, dave.hansen,
hpa, mhocko, tj, corbet, rakie.kim, hyeongtak.ji, honggyu.kim,
vtavarespetr, peterz, jgroves, ravis.opensrc, sthanneeru,
emirakhur, Hasan.Maruf, seungjun.ha, Srinivasulu Thanneeru
In-Reply-To: <875y09d5d8.fsf@yhuang6-desk2.ccr.corp.intel.com>
On Thu, Jan 04, 2024 at 01:39:31PM +0800, Huang, Ying wrote:
> Gregory Price <gregory.price@memverge.com> writes:
>
> > On Wed, Jan 03, 2024 at 01:46:56PM +0800, Huang, Ying wrote:
> >> Gregory Price <gregory.price@memverge.com> writes:
> >> > I'm specifically concerned about:
> >> > weighted_interleave_nid
> >> > alloc_pages_bulk_array_weighted_interleave
> >> >
> >> > I'm unsure whether kmalloc/kfree is safe (and non-offensive) in those
> >> > contexts. If kmalloc/kfree is safe fine, this problem is trivial.
> >> >
> >> > If not, there is no good solution to this without pre-allocating a
> >> > scratch area per-task.
> >>
> >> You need to audit whether it's safe for all callers. I guess that you
> >> need to allocate pages after calling, so you can use the same GFP flags
> >> here.
> >>
> >
> > After picking away i realized that this code is usually going to get
> > called during page fault handling - duh. So kmalloc is almost never
> > safe (or can fail), and we it's nasty to try to handle those errors.
>
> Why not just OOM for allocation failure?
>
2 notes:
1) callers of weighted_interleave_nid do not expect OOM conditions, they
expect a node selection. On error, we would simply return the local
numa node without indication of failure.
2) callers of alloc_pages_bulk_array_weighted_interleave receive the
total number of pages allocated, and they are expected to detect
pages allocated != pages requested, and then handle whether to
OOM or simply retry (allocation may fail for a variety of reasons).
By introducing an allocation into this area, if an allocation failure
occurs, we would essentially need to silently squash it and return
either local_node (interleave_nid) or return 0 (bulk allocator) and
allow the allocation logic to handle any subsequent OOM condition.
That felt less desirable than just allocating a scratch space up front
in the mempolicy and avoiding the issue altogether.
> > Instead of doing that, I simply chose to implement the scratch space
> > in the mempolicy structure
> >
> > mempolicy->wil.scratch_weights[MAX_NUMNODES].
> >
> > We eat an extra 1kb of memory in the mempolicy, but it gives us a safe
> > scratch space we can use any time the task is allocating memory, and
> > prevents the need for any fancy error handling. That seems like a
> > perfectly reasonable tradeoff.
>
> I don't think that this is a good idea. The weight array is temporary.
>
It's temporary, but it's also only used in the context of the task while
the alloc lock is held.
If you think it's fine to introduce another potential OOM generating
spot, then I'll just go ahead and allocate the memory on the fly.
I do want to point out, though, that weighted_interleave_nid is called
per allocated page. So now we're not just collecting weights to
calculate the offset, we're doing an allocation (that can fail) per page
allocated for that region.
The bulk allocator amortizes the cost of this allocation by doing it
once while allocating a chunk of pages - but the weighted_interleave_nid
function is called per-page.
By comparison, the memory cost to just allocate a static scratch area in
the mempolicy struct is only incurred by tasks with a mempolicy.
So we're talking ~1MB for 1024 threads with mempolicies to avoid error
conditions mid-page-allocation and to reduce the cost associated with
applying weighted interleave.
~Gregory
^ permalink raw reply
* [PATCH 5/5] docs: userspace-api/api: include ABI/README.rst
From: Vegard Nossum @ 2024-01-04 16:09 UTC (permalink / raw)
To: Jonathan Corbet
Cc: Randy Dunlap, Mauro Carvalho Chehab, Greg Kroah-Hartman,
Jani Nikula, linux-doc, linux-api, Vegard Nossum
In-Reply-To: <20240104160946.3450743-1-vegard.nossum@oracle.com>
The rendered ABI documents currently have no introduction or
explanation, which is a bit jarring.
Documentation/ABI/README is a pretty good introduction, even if it's
aimed more at ABI-description producers (rather than consumers) -- we
can always tweak the language to be clearer about this distinction
later.
Include it in userspace-api/api.rst.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
---
Documentation/userspace-api/abi.rst | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Documentation/userspace-api/abi.rst b/Documentation/userspace-api/abi.rst
index bcab3ef2597c..ea615233a405 100644
--- a/Documentation/userspace-api/abi.rst
+++ b/Documentation/userspace-api/abi.rst
@@ -2,7 +2,10 @@
Linux ABI description
=====================
+.. include:: ../ABI/README.rst
+
.. toctree::
+ :caption: Directory
:maxdepth: 2
abi-stable
--
2.34.1
^ permalink raw reply related
* [PATCH 2/5] docs: move admin-guide/abi*.rst to userspace-api/
From: Vegard Nossum @ 2024-01-04 16:09 UTC (permalink / raw)
To: Jonathan Corbet
Cc: Randy Dunlap, Mauro Carvalho Chehab, Greg Kroah-Hartman,
Jani Nikula, linux-doc, linux-api, Vegard Nossum
In-Reply-To: <20240104160946.3450743-1-vegard.nossum@oracle.com>
These files describe the kernel <-> userspace ABI and belongs with the
userspace API guide.
The new text was adapted from Documentation/ABI/README.
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
---
Documentation/admin-guide/index.rst | 1 -
.../{admin-guide => userspace-api}/abi-obsolete.rst | 0
.../{admin-guide => userspace-api}/abi-removed.rst | 0
.../{admin-guide => userspace-api}/abi-stable.rst | 0
.../{admin-guide => userspace-api}/abi-testing.rst | 0
Documentation/{admin-guide => userspace-api}/abi.rst | 0
Documentation/userspace-api/index.rst | 8 ++++++++
7 files changed, 8 insertions(+), 1 deletion(-)
rename Documentation/{admin-guide => userspace-api}/abi-obsolete.rst (100%)
rename Documentation/{admin-guide => userspace-api}/abi-removed.rst (100%)
rename Documentation/{admin-guide => userspace-api}/abi-stable.rst (100%)
rename Documentation/{admin-guide => userspace-api}/abi-testing.rst (100%)
rename Documentation/{admin-guide => userspace-api}/abi.rst (100%)
diff --git a/Documentation/admin-guide/index.rst b/Documentation/admin-guide/index.rst
index c2b032314a24..fb055d926f6a 100644
--- a/Documentation/admin-guide/index.rst
+++ b/Documentation/admin-guide/index.rst
@@ -18,7 +18,6 @@ etc.
devices
sysctl/index
- abi
features
This section describes CPU vulnerabilities and their mitigations.
diff --git a/Documentation/admin-guide/abi-obsolete.rst b/Documentation/userspace-api/abi-obsolete.rst
similarity index 100%
rename from Documentation/admin-guide/abi-obsolete.rst
rename to Documentation/userspace-api/abi-obsolete.rst
diff --git a/Documentation/admin-guide/abi-removed.rst b/Documentation/userspace-api/abi-removed.rst
similarity index 100%
rename from Documentation/admin-guide/abi-removed.rst
rename to Documentation/userspace-api/abi-removed.rst
diff --git a/Documentation/admin-guide/abi-stable.rst b/Documentation/userspace-api/abi-stable.rst
similarity index 100%
rename from Documentation/admin-guide/abi-stable.rst
rename to Documentation/userspace-api/abi-stable.rst
diff --git a/Documentation/admin-guide/abi-testing.rst b/Documentation/userspace-api/abi-testing.rst
similarity index 100%
rename from Documentation/admin-guide/abi-testing.rst
rename to Documentation/userspace-api/abi-testing.rst
diff --git a/Documentation/admin-guide/abi.rst b/Documentation/userspace-api/abi.rst
similarity index 100%
rename from Documentation/admin-guide/abi.rst
rename to Documentation/userspace-api/abi.rst
diff --git a/Documentation/userspace-api/index.rst b/Documentation/userspace-api/index.rst
index 6ce2edf519f6..275f70f3bcbe 100644
--- a/Documentation/userspace-api/index.rst
+++ b/Documentation/userspace-api/index.rst
@@ -42,6 +42,14 @@ Subsystem-specific documentation:
isapnp
dcdbas
+Kernel ABIs: These documents describe the the ABI between the Linux
+kernel and userspace, and the relative stability of these interfaces.
+
+.. toctree::
+ :maxdepth: 2
+
+ abi
+
.. only:: subproject and html
Indices
--
2.34.1
^ permalink raw reply related
* [PATCH 4/5] Documentation/ABI/README: convert to ReST
From: Vegard Nossum @ 2024-01-04 16:09 UTC (permalink / raw)
To: Jonathan Corbet
Cc: Randy Dunlap, Mauro Carvalho Chehab, Greg Kroah-Hartman,
Jani Nikula, linux-doc, linux-api, Vegard Nossum
In-Reply-To: <20240104160946.3450743-1-vegard.nossum@oracle.com>
This file is basically ReST syntax already -- with just a few tweaks we
can include this in the rendered HTML documentation which currently has
no introduction or explanation.
References to this document were found and fixed with some variant of:
git grep -Pl 'ABI/README(?!\.rst)' | xargs sed -i 's|\(Documentation/ABI/README\)|\1\.rst|g'
plus manual inspection and reflows where necessary.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
---
Documentation/ABI/{README => README.rst} | 36 +++++++++----------
Documentation/Kconfig | 8 ++---
Documentation/filesystems/sysfs.rst | 4 +--
Documentation/process/4.Coding.rst | 4 +--
Documentation/process/submit-checklist.rst | 2 +-
.../translations/it_IT/process/4.Coding.rst | 4 +--
.../it_IT/process/submit-checklist.rst | 2 +-
.../translations/ja_JP/SubmitChecklist | 2 +-
.../sp_SP/process/submit-checklist.rst | 2 +-
.../translations/zh_CN/filesystems/sysfs.txt | 2 +-
.../translations/zh_CN/process/4.Coding.rst | 2 +-
.../zh_CN/process/submit-checklist.rst | 2 +-
.../translations/zh_TW/filesystems/sysfs.txt | 2 +-
.../translations/zh_TW/process/4.Coding.rst | 2 +-
.../zh_TW/process/submit-checklist.rst | 2 +-
15 files changed, 38 insertions(+), 38 deletions(-)
rename Documentation/ABI/{README => README.rst} (82%)
diff --git a/Documentation/ABI/README b/Documentation/ABI/README.rst
similarity index 82%
rename from Documentation/ABI/README
rename to Documentation/ABI/README.rst
index 8bac9cb09a6d..04f5d05d6caa 100644
--- a/Documentation/ABI/README
+++ b/Documentation/ABI/README.rst
@@ -41,24 +41,24 @@ The different levels of stability are:
This directory contains a list of the old interfaces that have
been removed from the kernel.
-Every file in these directories will contain the following information:
-
-What: Short description of the interface
-Date: Date created
-KernelVersion: Kernel version this feature first showed up in.
-Contact: Primary contact for this interface (may be a mailing list)
-Description: Long description of the interface and how to use it.
-Users: All users of this interface who wish to be notified when
- it changes. This is very important for interfaces in
- the "testing" stage, so that kernel developers can work
- with userspace developers to ensure that things do not
- break in ways that are unacceptable. It is also
- important to get feedback for these interfaces to make
- sure they are working in a proper way and do not need to
- be changed further.
-
-
-Note:
+Every file in these directories will contain the following information::
+
+ What: Short description of the interface
+ Date: Date created
+ KernelVersion: Kernel version this feature first showed up in.
+ Contact: Primary contact for this interface (may be a mailing list)
+ Description: Long description of the interface and how to use it.
+ Users: All users of this interface who wish to be notified when
+ it changes. This is very important for interfaces in
+ the "testing" stage, so that kernel developers can work
+ with userspace developers to ensure that things do not
+ break in ways that are unacceptable. It is also
+ important to get feedback for these interfaces to make
+ sure they are working in a proper way and do not need to
+ be changed further.
+
+.. note::
+
The fields should be use a simple notation, compatible with ReST markup.
Also, the file **should not** have a top-level index, like::
diff --git a/Documentation/Kconfig b/Documentation/Kconfig
index 3a0e7ac0c4e3..8e690a4f1a64 100644
--- a/Documentation/Kconfig
+++ b/Documentation/Kconfig
@@ -16,10 +16,10 @@ config WARN_ABI_ERRORS
bool "Warn if there are errors at ABI files"
help
The files under Documentation/ABI should follow what's
- described at Documentation/ABI/README. Yet, as they're manually
- written, it would be possible that some of those files would
- have errors that would break them for being parsed by
- scripts/get_abi.pl. Add a check to verify them.
+ described at Documentation/ABI/README.rst. Yet, as they're
+ manually written, it would be possible that some of those
+ files would have errors that would break them for being parsed
+ by scripts/get_abi.pl. Add a check to verify them.
If unsure, select 'N'.
diff --git a/Documentation/filesystems/sysfs.rst b/Documentation/filesystems/sysfs.rst
index c32993bc83c7..e30694706b15 100644
--- a/Documentation/filesystems/sysfs.rst
+++ b/Documentation/filesystems/sysfs.rst
@@ -418,5 +418,5 @@ Documentation
The sysfs directory structure and the attributes in each directory define an
ABI between the kernel and user space. As for any ABI, it is important that
this ABI is stable and properly documented. All new sysfs attributes must be
-documented in Documentation/ABI. See also Documentation/ABI/README for more
-information.
+documented in Documentation/ABI. See also Documentation/ABI/README.rst for
+more information.
diff --git a/Documentation/process/4.Coding.rst b/Documentation/process/4.Coding.rst
index 1f0d81f44e14..120d126ee288 100644
--- a/Documentation/process/4.Coding.rst
+++ b/Documentation/process/4.Coding.rst
@@ -347,8 +347,8 @@ information.
Any code which adds a new user-space interface - including new sysfs or
/proc files - should include documentation of that interface which enables
user-space developers to know what they are working with. See
-Documentation/ABI/README for a description of how this documentation should
-be formatted and what information needs to be provided.
+Documentation/ABI/README.rst for a description of how this documentation
+should be formatted and what information needs to be provided.
The file :ref:`Documentation/admin-guide/kernel-parameters.rst
<kernelparameters>` describes all of the kernel's boot-time parameters.
diff --git a/Documentation/process/submit-checklist.rst b/Documentation/process/submit-checklist.rst
index b1bc2d37bd0a..7e6198ab368d 100644
--- a/Documentation/process/submit-checklist.rst
+++ b/Documentation/process/submit-checklist.rst
@@ -85,7 +85,7 @@ and elsewhere regarding submitting Linux kernel patches.
17) All new module parameters are documented with ``MODULE_PARM_DESC()``
18) All new userspace interfaces are documented in ``Documentation/ABI/``.
- See ``Documentation/ABI/README`` for more information.
+ See ``Documentation/ABI/README.rst`` for more information.
Patches that change userspace interfaces should be CCed to
linux-api@vger.kernel.org.
diff --git a/Documentation/translations/it_IT/process/4.Coding.rst b/Documentation/translations/it_IT/process/4.Coding.rst
index 54fd255b77d0..631d56ae56dc 100644
--- a/Documentation/translations/it_IT/process/4.Coding.rst
+++ b/Documentation/translations/it_IT/process/4.Coding.rst
@@ -365,8 +365,8 @@ informazione.
Qualsiasi codice che aggiunge una nuova interfaccia in spazio utente - inclusi
nuovi file in sysfs o /proc - dovrebbe includere la documentazione di tale
interfaccia così da permette agli sviluppatori dello spazio utente di sapere
-con cosa stanno lavorando. Consultate: Documentation/ABI/README per avere una
-descrizione di come questi documenti devono essere impostati e quali
+con cosa stanno lavorando. Consultate: Documentation/ABI/README.rst per avere
+una descrizione di come questi documenti devono essere impostati e quali
informazioni devono essere fornite.
Il file :ref:`Documentation/translations/it_IT/admin-guide/kernel-parameters.rst <kernelparameters>`
diff --git a/Documentation/translations/it_IT/process/submit-checklist.rst b/Documentation/translations/it_IT/process/submit-checklist.rst
index 2fc09cc1f0be..828c8f27d492 100644
--- a/Documentation/translations/it_IT/process/submit-checklist.rst
+++ b/Documentation/translations/it_IT/process/submit-checklist.rst
@@ -94,7 +94,7 @@ sottomissione delle patch, in particolare
18) Tutti i nuovi parametri dei moduli sono documentati con ``MODULE_PARM_DESC()``.
19) Tutte le nuove interfacce verso lo spazio utente sono documentate in
- ``Documentation/ABI/``. Leggete ``Documentation/ABI/README`` per maggiori
+ ``Documentation/ABI/``. Leggete ``Documentation/ABI/README.rst`` per maggiori
informazioni. Le patch che modificano le interfacce utente dovrebbero
essere inviate in copia anche a linux-api@vger.kernel.org.
diff --git a/Documentation/translations/ja_JP/SubmitChecklist b/Documentation/translations/ja_JP/SubmitChecklist
index 4429447b0965..87867c47bffd 100644
--- a/Documentation/translations/ja_JP/SubmitChecklist
+++ b/Documentation/translations/ja_JP/SubmitChecklist
@@ -86,7 +86,7 @@ Linux カーネルパッチ投稿者向けチェックリスト
利用して必ずその説明を記述してください。
18: 新しいuserspaceインタフェースを作成した場合には、Documentation/ABI/ に
- Documentation/ABI/README を参考にして必ずドキュメントを追加してください。
+ Documentation/ABI/README.rst を参考にして必ずドキュメントを追加してください。
19: 少なくともslabアロケーションとpageアロケーションに失敗した場合の
挙動について、fault-injectionを利用して確認してください。
diff --git a/Documentation/translations/sp_SP/process/submit-checklist.rst b/Documentation/translations/sp_SP/process/submit-checklist.rst
index 0d6651f9d871..b8072be18532 100644
--- a/Documentation/translations/sp_SP/process/submit-checklist.rst
+++ b/Documentation/translations/sp_SP/process/submit-checklist.rst
@@ -97,7 +97,7 @@ y en otros lugares con respecto al envío de parches del kernel de Linux.
``MODULE_PARM_DESC()``.
18) Todas las nuevas interfaces de espacio de usuario están documentadas
- en ``Documentation/ABI/``. Consulte ``Documentation/ABI/README`` para
+ en ``Documentation/ABI/``. Consulte ``Documentation/ABI/README.rst`` para
obtener más información. Los parches que cambian las interfaces del
espacio de usuario deben ser CCed a linux-api@vger.kernel.org.
diff --git a/Documentation/translations/zh_CN/filesystems/sysfs.txt b/Documentation/translations/zh_CN/filesystems/sysfs.txt
index 547062759e60..871fc60aeeca 100644
--- a/Documentation/translations/zh_CN/filesystems/sysfs.txt
+++ b/Documentation/translations/zh_CN/filesystems/sysfs.txt
@@ -370,4 +370,4 @@ void driver_remove_file(struct device_driver *, const struct driver_attribute *)
sysfs 目录结构以及其中包含的属性定义了一个内核与用户空间之间的 ABI。
对于任何 ABI,其自身的稳定和适当的文档是非常重要的。所有新的 sysfs
-属性必须在 Documentation/ABI 中有文档。详见 Documentation/ABI/README。
+属性必须在 Documentation/ABI 中有文档。详见 Documentation/ABI/README.rst。
diff --git a/Documentation/translations/zh_CN/process/4.Coding.rst b/Documentation/translations/zh_CN/process/4.Coding.rst
index 7cac9424f5d5..1b752b3bdc8c 100644
--- a/Documentation/translations/zh_CN/process/4.Coding.rst
+++ b/Documentation/translations/zh_CN/process/4.Coding.rst
@@ -244,7 +244,7 @@ scripts/coccinelle目录下已经打包了相当多的内核“语义补丁”
任何添加新用户空间接口的代码——包括新的sysfs或/proc文件——都应该包含该接口
的文档,该文档使用户空间开发人员能够知道他们在使用什么。请参阅
-Documentation/ABI/README,了解如何此文档格式以及需要提供哪些信息。
+Documentation/ABI/README.rst,了解如何此文档格式以及需要提供哪些信息。
文档 :ref:`Documentation/admin-guide/kernel-parameters.rst <kernelparameters>`
描述了内核的所有引导时间参数。任何添加新参数的补丁都应该向该文档添加适当的
diff --git a/Documentation/translations/zh_CN/process/submit-checklist.rst b/Documentation/translations/zh_CN/process/submit-checklist.rst
index 3d6ee21c74ae..0942021202a3 100644
--- a/Documentation/translations/zh_CN/process/submit-checklist.rst
+++ b/Documentation/translations/zh_CN/process/submit-checklist.rst
@@ -83,7 +83,7 @@ Linux内核补丁提交检查单
17) 所有新的模块参数都记录在 ``MODULE_PARM_DESC()``
18) 所有新的用户空间接口都记录在 ``Documentation/ABI/`` 中。有关详细信息,
- 请参阅 ``Documentation/ABI/README`` 。更改用户空间接口的补丁应该抄送
+ 请参阅 ``Documentation/ABI/README.rst`` 。更改用户空间接口的补丁应该抄送
linux-api@vger.kernel.org。
19) 已通过至少注入slab和page分配失败进行检查。请参阅 ``Documentation/fault-injection/`` 。
diff --git a/Documentation/translations/zh_TW/filesystems/sysfs.txt b/Documentation/translations/zh_TW/filesystems/sysfs.txt
index 978462d5fe14..a94e83dcb814 100644
--- a/Documentation/translations/zh_TW/filesystems/sysfs.txt
+++ b/Documentation/translations/zh_TW/filesystems/sysfs.txt
@@ -373,5 +373,5 @@ void driver_remove_file(struct device_driver *, const struct driver_attribute *)
sysfs 目錄結構以及其中包含的屬性定義了一個內核與用戶空間之間的 ABI。
對於任何 ABI,其自身的穩定和適當的文檔是非常重要的。所有新的 sysfs
-屬性必須在 Documentation/ABI 中有文檔。詳見 Documentation/ABI/README。
+屬性必須在 Documentation/ABI 中有文檔。詳見 Documentation/ABI/README.rst。
diff --git a/Documentation/translations/zh_TW/process/4.Coding.rst b/Documentation/translations/zh_TW/process/4.Coding.rst
index bdd2abe4daf4..541e09ae1440 100644
--- a/Documentation/translations/zh_TW/process/4.Coding.rst
+++ b/Documentation/translations/zh_TW/process/4.Coding.rst
@@ -247,7 +247,7 @@ scripts/coccinelle目錄下已經打包了相當多的內核“語義補丁”
任何添加新用戶空間接口的代碼——包括新的sysfs或/proc文件——都應該包含該接口
的文檔,該文檔使用戶空間開發人員能夠知道他們在使用什麼。請參閱
-Documentation/ABI/README,瞭解如何此文檔格式以及需要提供哪些信息。
+Documentation/ABI/README.rst,瞭解如何此文檔格式以及需要提供哪些信息。
文檔 :ref:`Documentation/admin-guide/kernel-parameters.rst <kernelparameters>`
描述了內核的所有引導時間參數。任何添加新參數的補丁都應該向該文檔添加適當的
diff --git a/Documentation/translations/zh_TW/process/submit-checklist.rst b/Documentation/translations/zh_TW/process/submit-checklist.rst
index e57ef0f99e0c..efece58cb5b2 100644
--- a/Documentation/translations/zh_TW/process/submit-checklist.rst
+++ b/Documentation/translations/zh_TW/process/submit-checklist.rst
@@ -86,7 +86,7 @@ Linux內核補丁提交檢查單
17) 所有新的模塊參數都記錄在 ``MODULE_PARM_DESC()``
18) 所有新的用戶空間接口都記錄在 ``Documentation/ABI/`` 中。有關詳細信息,
- 請參閱 ``Documentation/ABI/README`` 。更改用戶空間接口的補丁應該抄送
+ 請參閱 ``Documentation/ABI/README.rst`` 。更改用戶空間接口的補丁應該抄送
linux-api@vger.kernel.org。
19) 已通過至少注入slab和page分配失敗進行檢查。請參閱 ``Documentation/fault-injection/`` 。
--
2.34.1
^ permalink raw reply related
* [PATCH 1/5] docs: move admin-guide/sysfs-rules.rst to userspace-api/
From: Vegard Nossum @ 2024-01-04 16:09 UTC (permalink / raw)
To: Jonathan Corbet
Cc: Randy Dunlap, Mauro Carvalho Chehab, Greg Kroah-Hartman,
Jani Nikula, linux-doc, linux-api, Vegard Nossum
This file documents how userspace ought to interact with sysfs. It is
clearly intended for applications that access sysfs programmatically,
rather than at users or admins.
Move it to the userspace API guide.
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
---
Documentation/ABI/stable/sysfs-devices | 2 +-
Documentation/admin-guide/index.rst | 9 ---------
Documentation/userspace-api/index.rst | 10 +++++++++-
.../{admin-guide => userspace-api}/sysfs-rules.rst | 0
tools/lib/api/fs/fs.c | 2 +-
5 files changed, 11 insertions(+), 12 deletions(-)
rename Documentation/{admin-guide => userspace-api}/sysfs-rules.rst (100%)
diff --git a/Documentation/ABI/stable/sysfs-devices b/Documentation/ABI/stable/sysfs-devices
index 98a8ef99ac5f..7829414cba62 100644
--- a/Documentation/ABI/stable/sysfs-devices
+++ b/Documentation/ABI/stable/sysfs-devices
@@ -1,6 +1,6 @@
Note:
This documents additional properties of any device beyond what
- is documented in Documentation/admin-guide/sysfs-rules.rst
+ is documented in Documentation/userspace-api/sysfs-rules.rst
What: /sys/devices/*/of_node
Date: February 2015
diff --git a/Documentation/admin-guide/index.rst b/Documentation/admin-guide/index.rst
index 43ea35613dfc..c2b032314a24 100644
--- a/Documentation/admin-guide/index.rst
+++ b/Documentation/admin-guide/index.rst
@@ -47,15 +47,6 @@ problems and bugs in particular.
perf/index
pstore-blk
-This is the beginning of a section with information of interest to
-application developers. Documents covering various aspects of the kernel
-ABI will be found here.
-
-.. toctree::
- :maxdepth: 1
-
- sysfs-rules
-
This is the beginning of a section with information of interest to
application developers and system integrators doing analysis of the
Linux kernel for safety critical applications. Documents supporting
diff --git a/Documentation/userspace-api/index.rst b/Documentation/userspace-api/index.rst
index 74bc0716432e..6ce2edf519f6 100644
--- a/Documentation/userspace-api/index.rst
+++ b/Documentation/userspace-api/index.rst
@@ -9,8 +9,16 @@ While much of the kernel's user-space API is documented elsewhere
also be found in the kernel tree itself. This manual is intended to be the
place where this information is gathered.
+General documentation:
+
+.. toctree::
+ :maxdepth: 1
+
+ sysfs-rules
+
+Subsystem-specific documentation:
+
.. toctree::
- :caption: Table of contents
:maxdepth: 2
no_new_privs
diff --git a/Documentation/admin-guide/sysfs-rules.rst b/Documentation/userspace-api/sysfs-rules.rst
similarity index 100%
rename from Documentation/admin-guide/sysfs-rules.rst
rename to Documentation/userspace-api/sysfs-rules.rst
diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index 5cb0eeec2c8a..c35247b6ad81 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -214,7 +214,7 @@ static void mem_toupper(char *f, size_t len)
/*
* Check for "NAME_PATH" environment variable to override fs location (for
- * testing). This matches the recommendation in Documentation/admin-guide/sysfs-rules.rst
+ * testing). This matches the recommendation in Documentation/userspace-api/sysfs-rules.rst
* for SYSFS_PATH.
*/
static bool fs__env_override(struct fs *fs)
--
2.34.1
^ permalink raw reply related
* [PATCH 3/5] docs: userspace-api: use single toctree level
From: Vegard Nossum @ 2024-01-04 16:09 UTC (permalink / raw)
To: Jonathan Corbet
Cc: Randy Dunlap, Mauro Carvalho Chehab, Greg Kroah-Hartman,
Jani Nikula, linux-doc, linux-api, Vegard Nossum
In-Reply-To: <20240104160946.3450743-1-vegard.nossum@oracle.com>
Having a single toctree level makes this page more readable at a glance.
This also makes it more like the other top-level books (process,
admin-guide, etc.).
We can also consider using proper headings like process/index does, but
this is at least a step in the right direction.
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
---
Documentation/userspace-api/index.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Documentation/userspace-api/index.rst b/Documentation/userspace-api/index.rst
index 275f70f3bcbe..82f9dbd228f5 100644
--- a/Documentation/userspace-api/index.rst
+++ b/Documentation/userspace-api/index.rst
@@ -19,7 +19,7 @@ General documentation:
Subsystem-specific documentation:
.. toctree::
- :maxdepth: 2
+ :maxdepth: 1
no_new_privs
seccomp_filter
--
2.34.1
^ permalink raw reply related
* Re: [PATCH v5 02/11] mm/mempolicy: introduce MPOL_WEIGHTED_INTERLEAVE for weighted interleaving
From: Huang, Ying @ 2024-01-04 5:39 UTC (permalink / raw)
To: Gregory Price
Cc: Gregory Price, linux-mm, linux-doc, linux-fsdevel, linux-kernel,
linux-api, x86, akpm, arnd, tglx, luto, mingo, bp, dave.hansen,
hpa, mhocko, tj, corbet, rakie.kim, hyeongtak.ji, honggyu.kim,
vtavarespetr, peterz, jgroves, ravis.opensrc, sthanneeru,
emirakhur, Hasan.Maruf, seungjun.ha, Srinivasulu Thanneeru
In-Reply-To: <ZZXbN4+2nVbE/lRe@memverge.com>
Gregory Price <gregory.price@memverge.com> writes:
> On Wed, Jan 03, 2024 at 01:46:56PM +0800, Huang, Ying wrote:
>> Gregory Price <gregory.price@memverge.com> writes:
>> > I'm specifically concerned about:
>> > weighted_interleave_nid
>> > alloc_pages_bulk_array_weighted_interleave
>> >
>> > I'm unsure whether kmalloc/kfree is safe (and non-offensive) in those
>> > contexts. If kmalloc/kfree is safe fine, this problem is trivial.
>> >
>> > If not, there is no good solution to this without pre-allocating a
>> > scratch area per-task.
>>
>> You need to audit whether it's safe for all callers. I guess that you
>> need to allocate pages after calling, so you can use the same GFP flags
>> here.
>>
>
> After picking away i realized that this code is usually going to get
> called during page fault handling - duh. So kmalloc is almost never
> safe (or can fail), and we it's nasty to try to handle those errors.
Why not just OOM for allocation failure?
> Instead of doing that, I simply chose to implement the scratch space
> in the mempolicy structure
>
> mempolicy->wil.scratch_weights[MAX_NUMNODES].
>
> We eat an extra 1kb of memory in the mempolicy, but it gives us a safe
> scratch space we can use any time the task is allocating memory, and
> prevents the need for any fancy error handling. That seems like a
> perfectly reasonable tradeoff.
I don't think that this is a good idea. The weight array is temporary.
--
Best Regards,
Huang, Ying
^ permalink raw reply
* Re: [PATCH v5] posix-timers: add multi_clock_gettime system call
From: kernel test robot @ 2024-01-04 3:06 UTC (permalink / raw)
To: Sagi Maimon, richardcochran, luto, datglx, mingo, bp, dave.hansen,
x86, hpa, arnd, geert, peterz, hannes, sohil.mehta,
rick.p.edgecombe, nphamcs, palmer, keescook, legion, mark.rutland
Cc: oe-kbuild-all, linux-kernel, linux-api, linux-arch, netdev
In-Reply-To: <20240102091855.70418-1-maimon.sagi@gmail.com>
Hi Sagi,
kernel test robot noticed the following build errors:
[auto build test ERROR on tip/x86/asm]
[also build test ERROR on arnd-asm-generic/master tip/timers/core linus/master v6.7-rc8]
[cannot apply to next-20240103]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Sagi-Maimon/posix-timers-add-multi_clock_gettime-system-call/20240102-172105
base: tip/x86/asm
patch link: https://lore.kernel.org/r/20240102091855.70418-1-maimon.sagi%40gmail.com
patch subject: [PATCH v5] posix-timers: add multi_clock_gettime system call
config: csky-randconfig-002-20240104 (https://download.01.org/0day-ci/archive/20240104/202401041000.T0GQPIBW-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240104/202401041000.T0GQPIBW-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401041000.T0GQPIBW-lkp@intel.com/
All errors (new ones prefixed by >>):
>> csky-linux-ld: arch/csky/kernel/syscall_table.o:(.data..page_aligned+0x724): undefined reference to `sys_multi_clock_gettime'
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply
* Re: [PATCH v6 08/12] mm/mempolicy: add userland mempolicy arg structure
From: Gregory Price @ 2024-01-04 2:03 UTC (permalink / raw)
To: Randy Dunlap
Cc: Gregory Price, linux-mm, linux-doc, linux-fsdevel, linux-kernel,
linux-api, linux-arch, akpm, arnd, tglx, luto, mingo, bp,
dave.hansen, hpa, mhocko, tj, ying.huang, corbet, rakie.kim,
hyeongtak.ji, honggyu.kim, vtavarespetr, peterz, jgroves,
ravis.opensrc, sthanneeru, emirakhur, Hasan.Maruf, seungjun.ha,
Frank van der Linden
In-Reply-To: <429dd825-204a-4b11-87fd-ce9d39040d4d@infradead.org>
On Wed, Jan 03, 2024 at 04:19:03PM -0800, Randy Dunlap wrote:
> Hi,
>
> On 1/3/24 14:42, Gregory Price wrote:
> > This patch adds the new user-api argument structure intended for
> > set_mempolicy2 and mbind2.
> >
> > struct mpol_param {
> > __u16 mode;
> > __u16 mode_flags;
> > __s32 home_node; /* mbind2: policy home node */
> > __u16 pol_maxnodes;
> > __u8 resv[6];
> > __aligned_u64 *pol_nodes;
> > };
> >
> >
> > +Extended Mempolicy Arguments::
> > +
> > + struct mpol_param {
> > + __u16 mode;
> > + __u16 mode_flags;
> > + __s32 home_node; /* mbind2: set home node */
> > + __u64 pol_maxnodes;
> > + __aligned_u64 pol_nodes; /* nodemask pointer */
> > + };
> >
>
> Can you make the above documentation struct agree with the
> struct in the header below, please?
> (just a difference in the size of pol_maxnodes and the
> 'resv' bytes)
>
>
*facepalm* made a note to double check this, and then still didn't.
Thank you for reviewing. Will fix in the next pass of feedback.
~Gregory
^ permalink raw reply
* Re: [PATCH v6 08/12] mm/mempolicy: add userland mempolicy arg structure
From: Randy Dunlap @ 2024-01-04 0:19 UTC (permalink / raw)
To: Gregory Price, linux-mm
Cc: linux-doc, linux-fsdevel, linux-kernel, linux-api, linux-arch,
akpm, arnd, tglx, luto, mingo, bp, dave.hansen, hpa, mhocko, tj,
ying.huang, gregory.price, corbet, rakie.kim, hyeongtak.ji,
honggyu.kim, vtavarespetr, peterz, jgroves, ravis.opensrc,
sthanneeru, emirakhur, Hasan.Maruf, seungjun.ha,
Frank van der Linden
In-Reply-To: <20240103224209.2541-9-gregory.price@memverge.com>
Hi,
On 1/3/24 14:42, Gregory Price wrote:
> This patch adds the new user-api argument structure intended for
> set_mempolicy2 and mbind2.
>
> struct mpol_param {
> __u16 mode;
> __u16 mode_flags;
> __s32 home_node; /* mbind2: policy home node */
> __u16 pol_maxnodes;
> __u8 resv[6];
> __aligned_u64 *pol_nodes;
> };
>
> This structure is intended to be extensible as new mempolicy extensions
> are added.
>
> For example, set_mempolicy_home_node was added to allow vma mempolicies
> to have a preferred/home node assigned. This structure allows the user
> to set the home node at the time mempolicy is created, rather than
> requiring an additional syscalls.
>
> Full breakdown of arguments as of this patch:
> mode: Mempolicy mode (MPOL_DEFAULT, MPOL_INTERLEAVE)
>
> mode_flags: Flags previously or'd into mode in set_mempolicy
> (e.g.: MPOL_F_STATIC_NODES, MPOL_F_RELATIVE_NODES)
>
> home_node: for mbind2. Allows the setting of a policy's home
> with the use of MPOL_MF_HOME_NODE
>
> pol_maxnodes: Max number of nodes in the policy nodemask
>
> pol_nodes: Policy nodemask
>
> The reserved field accounts explicitly for a potential memory hole
> in the structure.
>
> Suggested-by: Frank van der Linden <fvdl@google.com>
> Suggested-by: Vinicius Tavares Petrucci <vtavarespetr@micron.com>
> Suggested-by: Hasan Al Maruf <Hasan.Maruf@amd.com>
> Signed-off-by: Gregory Price <gregory.price@memverge.com>
> Co-developed-by: Vinicius Tavares Petrucci <vtavarespetr@micron.com>
> Signed-off-by: Vinicius Tavares Petrucci <vtavarespetr@micron.com>
> ---
> .../admin-guide/mm/numa_memory_policy.rst | 17 +++++++++++++++++
> include/linux/syscalls.h | 1 +
> include/uapi/linux/mempolicy.h | 9 +++++++++
> 3 files changed, 27 insertions(+)
>
> diff --git a/Documentation/admin-guide/mm/numa_memory_policy.rst b/Documentation/admin-guide/mm/numa_memory_policy.rst
> index a70f20ce1ffb..cbfc5f65ed77 100644
> --- a/Documentation/admin-guide/mm/numa_memory_policy.rst
> +++ b/Documentation/admin-guide/mm/numa_memory_policy.rst
> @@ -480,6 +480,23 @@ closest to which page allocation will come from. Specifying the home node overri
> the default allocation policy to allocate memory close to the local node for an
> executing CPU.
>
> +Extended Mempolicy Arguments::
> +
> + struct mpol_param {
> + __u16 mode;
> + __u16 mode_flags;
> + __s32 home_node; /* mbind2: set home node */
> + __u64 pol_maxnodes;
> + __aligned_u64 pol_nodes; /* nodemask pointer */
> + };
>
Can you make the above documentation struct agree with the
struct in the header below, please?
(just a difference in the size of pol_maxnodes and the
'resv' bytes)
> +The extended mempolicy argument structure is defined to allow the mempolicy
> +interfaces future extensibility without the need for additional system calls.
> +
> +The core arguments (mode, mode_flags, pol_nodes, and pol_maxnodes) apply to
> +all interfaces relative to their non-extended counterparts. Each additional
> +field may only apply to specific extended interfaces. See the respective
> +extended interface man page for more details.
>
> Memory Policy Command Line Interface
> ====================================
> diff --git a/include/uapi/linux/mempolicy.h b/include/uapi/linux/mempolicy.h
> index 1f9bb10d1a47..109788c8be92 100644
> --- a/include/uapi/linux/mempolicy.h
> +++ b/include/uapi/linux/mempolicy.h
> @@ -27,6 +27,15 @@ enum {
> MPOL_MAX, /* always last member of enum */
> };
>
> +struct mpol_param {
> + __u16 mode;
> + __u16 mode_flags;
> + __s32 home_node; /* mbind2: policy home node */
> + __u16 pol_maxnodes;
> + __u8 resv[6];
> + __aligned_u64 pol_nodes;
> +};
> +
> /* Flags for set_mempolicy */
> #define MPOL_F_STATIC_NODES (1 << 15)
> #define MPOL_F_RELATIVE_NODES (1 << 14)
--
#Randy
^ permalink raw reply
* [PATCH v6 12/12] mm/mempolicy: extend mempolicy2 and mbind2 to support weighted interleave
From: Gregory Price @ 2024-01-03 22:42 UTC (permalink / raw)
To: linux-mm
Cc: linux-doc, linux-fsdevel, linux-kernel, linux-api, linux-arch,
akpm, arnd, tglx, luto, mingo, bp, dave.hansen, hpa, mhocko, tj,
ying.huang, gregory.price, corbet, rakie.kim, hyeongtak.ji,
honggyu.kim, vtavarespetr, peterz, jgroves, ravis.opensrc,
sthanneeru, emirakhur, Hasan.Maruf, seungjun.ha
In-Reply-To: <20240103224209.2541-1-gregory.price@memverge.com>
Extend mempolicy2 and mbind2 to support weighted interleave, and
demonstrate the extensibility of the mpol_param structure.
To support weighted interleave we add interleave weight fields to the
following structures:
Kernel Internal: (include/linux/mempolicy.h)
struct mempolicy {
/* task-local weights to apply to weighted interleave */
u8 weights[MAX_NUMNODES];
}
struct mempolicy_param {
/* Optional: interleave weights for MPOL_WEIGHTED_INTERLEAVE */
u8 *il_weights; /* of size MAX_NUMNODES */
}
UAPI: (/include/uapi/linux/mempolicy.h)
struct mpol_param {
/* Optional: interleave weights for MPOL_WEIGHTED_INTERLEAVE */
__u8 *il_weights; /* of size pol_maxnodes */
}
The minimum weight of a node is always 1. If the user desires 0
allocations on a node, the node should be removed from the nodemask.
If the user does not provide weights (il_weights == NULL), global
weights will be used during allocation. Changes made to global weights
will be reflected in future allocations.
If the user provides weights and a weight is set to 0, the weight for
that node will be initialized to the global value.
If a user provides weights and a node is not set in the node mask,
the weight for that node will be set to the globally defined weight.
This is so a reasonable default value can be expected if the nodemask
changes (e.g. cgroups causes a migration or mems_allowed change).
Local weights are never updated when a global weight is updated.
Examples:
global weights: [4,4,2,2]
Set: Nodes-0,1,2,3 Weights: NULL
[global weights] are used.
Set: Nodes-0,1,2,3 Weights: [1,2,3,4]
local_weights = [1,2,3,4]
Set: Nodes-0,2 Weights: [2,0,2,0]
local_weights = [2,4,1,2]
Basic logic during allocation is as follows:
weight = pol->wil.weights[node]
/* if no local weight, use sysfs weight */
if (!weight)
weight = iw_table[weight]
/* if no sysfs weight, use system default */
if (!weight)
weight = default_iw_table[weight]
To simplify creations and duplication of mempolicies, the weights are
added as a structure directly within mempolicy. This allows the
existing logic in __mpol_dup to copy the weights without additional
allocations:
if (old == current->mempolicy) {
task_lock(current);
*new = *old;
task_unlock(current);
} else
*new = *old
Suggested-by: Rakie Kim <rakie.kim@sk.com>
Suggested-by: Hyeongtak Ji <hyeongtak.ji@sk.com>
Suggested-by: Honggyu Kim <honggyu.kim@sk.com>
Suggested-by: Vinicius Tavares Petrucci <vtavarespetr@micron.com>
Suggested-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Gregory Price <gregory.price@memverge.com>
Co-developed-by: Rakie Kim <rakie.kim@sk.com>
Signed-off-by: Rakie Kim <rakie.kim@sk.com>
Co-developed-by: Hyeongtak Ji <hyeongtak.ji@sk.com>
Signed-off-by: Hyeongtak Ji <hyeongtak.ji@sk.com>
Co-developed-by: Honggyu Kim <honggyu.kim@sk.com>
Signed-off-by: Honggyu Kim <honggyu.kim@sk.com>
Co-developed-by: Vinicius Tavares Petrucci <vtavarespetr@micron.com>
Signed-off-by: Vinicius Tavares Petrucci <vtavarespetr@micron.com>
---
.../admin-guide/mm/numa_memory_policy.rst | 12 ++
include/linux/mempolicy.h | 2 +
include/uapi/linux/mempolicy.h | 1 +
mm/mempolicy.c | 134 ++++++++++++++++--
4 files changed, 141 insertions(+), 8 deletions(-)
diff --git a/Documentation/admin-guide/mm/numa_memory_policy.rst b/Documentation/admin-guide/mm/numa_memory_policy.rst
index 66a778d58899..620b54ff2cef 100644
--- a/Documentation/admin-guide/mm/numa_memory_policy.rst
+++ b/Documentation/admin-guide/mm/numa_memory_policy.rst
@@ -254,11 +254,22 @@ MPOL_WEIGHTED_INTERLEAVE
This mode operates the same as MPOL_INTERLEAVE, except that
interleaving behavior is executed based on weights set in
/sys/kernel/mm/mempolicy/weighted_interleave/
+ when configured to utilize global weights, or based on task-local
+ weights configured with set_mempolicy2(2) or mbind2(2).
Weighted interleave allocates pages on nodes according to a
weight. For example if nodes [0,1] are weighted [5,2], 5 pages
will be allocated on node0 for every 2 pages allocated on node1.
+ When utilizing task-local weights, if node's is not set in the
+ nodemask, or its weight was set to 0, the local weight will be
+ set to the system default. Updates to system default weights
+ will not be refleted in local weights.
+
+ The minimum weight for a node set in the policy nodemask is
+ always 1. If no allocations on a node, the node should be
+ removed from the nodemask.
+
NUMA memory policy supports the following optional mode flags:
MPOL_F_STATIC_NODES
@@ -514,6 +525,7 @@ Extended Mempolicy Arguments::
__s32 home_node; /* mbind2: set home node */
__u64 pol_maxnodes;
__aligned_u64 pol_nodes; /* nodemask pointer */
+ __aligned_u64 il_weights; /* u8 buf of size pol_maxnodes */
};
The extended mempolicy argument structure is defined to allow the mempolicy
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index e6795e2d0cc2..9854790a9aac 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -58,6 +58,7 @@ struct mempolicy {
/* Weighted interleave settings */
struct {
u8 cur_weight;
+ u8 weights[MAX_NUMNODES];
u8 scratch_weights[MAX_NUMNODES]; /* Used to avoid allocations */
} wil;
};
@@ -71,6 +72,7 @@ struct mempolicy_param {
unsigned short mode_flags; /* policy mode flags */
int home_node; /* mbind: use MPOL_MF_HOME_NODE */
nodemask_t *policy_nodes; /* get/set/mbind */
+ u8 *il_weights; /* for mode MPOL_WEIGHTED_INTERLEAVE */
};
/*
diff --git a/include/uapi/linux/mempolicy.h b/include/uapi/linux/mempolicy.h
index 7c7c384479fc..06e0fc2bb29b 100644
--- a/include/uapi/linux/mempolicy.h
+++ b/include/uapi/linux/mempolicy.h
@@ -34,6 +34,7 @@ struct mpol_param {
__u16 pol_maxnodes;
__u8 resv[6];
__aligned_u64 pol_nodes;
+ __aligned_u64 il_weights; /* size: pol_maxnodes * sizeof(__u8) */
};
/* Flags for set_mempolicy */
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 53301e173c90..78e7614e0cd4 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -286,6 +286,7 @@ static struct mempolicy *mpol_new(struct mempolicy_param *param)
unsigned short mode = param->mode;
unsigned short flags = param->mode_flags;
nodemask_t *nodes = param->policy_nodes;
+ int node;
if (mode == MPOL_DEFAULT) {
if (nodes && !nodes_empty(*nodes))
@@ -323,6 +324,23 @@ static struct mempolicy *mpol_new(struct mempolicy_param *param)
policy->flags = flags;
policy->home_node = param->home_node;
policy->wil.cur_weight = 0;
+ memset(policy->wil.weights, 0, MAX_NUMNODES);
+
+ /* If user provides weights, ensure all weights are set to something */
+ if (policy->mode == MPOL_WEIGHTED_INTERLEAVE && param->il_weights) {
+ for (node = 0; node < MAX_NUMNODES; node++) {
+ u8 weight = 0;
+
+ if (node_isset(node, *nodes))
+ weight = param->il_weights[node];
+ /* If a user sets a weight to 0, use global default */
+ if (!weight)
+ weight = iw_table[node];
+ if (!weight)
+ weight = default_iw_table[node];
+ policy->wil.weights[node] = weight;
+ }
+ }
return policy;
}
@@ -952,6 +970,26 @@ static void do_get_mempolicy_nodemask(struct mempolicy *pol, nodemask_t *nmask)
}
}
+static void do_get_mempolicy_il_weights(struct mempolicy *pol,
+ u8 weights[MAX_NUMNODES])
+{
+ int i = 0;
+
+ if (pol->mode != MPOL_WEIGHTED_INTERLEAVE) {
+ memset(weights, 0, MAX_NUMNODES);
+ return;
+ }
+ for (i = 0; i < MAX_NUMNODES; i++) {
+ u8 weight = pol->wil.weights[i];
+
+ if (!weight)
+ weight = iw_table[i];
+ if (!weight)
+ weight = default_iw_table[i];
+ weights[i] = weight;
+ }
+}
+
/* Retrieve NUMA policy for a VMA assocated with a given address */
static long do_get_vma_mempolicy(unsigned long addr, int *addr_node,
struct mempolicy_param *param)
@@ -985,6 +1023,9 @@ static long do_get_vma_mempolicy(unsigned long addr, int *addr_node,
if (param->policy_nodes)
do_get_mempolicy_nodemask(pol, param->policy_nodes);
+ if (param->il_weights)
+ do_get_mempolicy_il_weights(pol, param->il_weights);
+
if (pol != &default_policy) {
mpol_put(pol);
mpol_cond_put(pol);
@@ -1012,6 +1053,9 @@ static long do_get_task_mempolicy(struct mempolicy_param *param, int *pol_node)
if (param->policy_nodes)
do_get_mempolicy_nodemask(pol, param->policy_nodes);
+ if (param->il_weights)
+ do_get_mempolicy_il_weights(pol, param->il_weights);
+
return 0;
}
@@ -1620,6 +1664,8 @@ SYSCALL_DEFINE5(mbind2, unsigned long, start, unsigned long, len,
struct mempolicy_param mparam;
nodemask_t policy_nodes;
unsigned long __user *nodes_ptr;
+ u8 *weights = NULL;
+ u8 __user *weights_ptr;
int err;
if (!start || !len)
@@ -1652,7 +1698,27 @@ SYSCALL_DEFINE5(mbind2, unsigned long, start, unsigned long, len,
return err;
mparam.policy_nodes = &policy_nodes;
- return do_mbind(untagged_addr(start), len, &mparam, flags);
+ if (kparam.mode == MPOL_WEIGHTED_INTERLEAVE) {
+ weights_ptr = u64_to_user_ptr(kparam.il_weights);
+ if (weights_ptr) {
+ weights = kzalloc(MAX_NUMNODES,
+ GFP_KERNEL | __GFP_NORETRY);
+ if (!weights)
+ return -ENOMEM;
+ err = copy_struct_from_user(weights,
+ MAX_NUMNODES,
+ weights_ptr,
+ kparam.pol_maxnodes);
+ if (err)
+ goto leave_weights;
+ }
+ }
+ mparam.il_weights = weights;
+
+ err = do_mbind(untagged_addr(start), len, &mparam, flags);
+leave_weights:
+ kfree(weights);
+ return err;
}
/* Set the process memory policy */
@@ -1696,6 +1762,8 @@ SYSCALL_DEFINE3(set_mempolicy2, struct mpol_param __user *, uparam,
int err;
nodemask_t policy_nodemask;
unsigned long __user *nodes_ptr;
+ u8 *weights = NULL;
+ u8 __user *weights_ptr;
if (flags)
return -EINVAL;
@@ -1721,7 +1789,24 @@ SYSCALL_DEFINE3(set_mempolicy2, struct mpol_param __user *, uparam,
} else
mparam.policy_nodes = NULL;
- return do_set_mempolicy(&mparam);
+ if (kparam.mode == MPOL_WEIGHTED_INTERLEAVE && kparam.il_weights) {
+ weights = kzalloc(MAX_NUMNODES, GFP_KERNEL | __GFP_NORETRY);
+ if (!weights)
+ return -ENOMEM;
+ weights_ptr = u64_to_user_ptr(kparam.il_weights);
+ err = copy_struct_from_user(weights,
+ MAX_NUMNODES,
+ weights_ptr,
+ kparam.pol_maxnodes);
+ if (err)
+ goto leave_weights;
+ }
+ mparam.il_weights = weights;
+
+ err = do_set_mempolicy(&mparam);
+leave_weights:
+ kfree(weights);
+ return err;
}
static int kernel_migrate_pages(pid_t pid, unsigned long maxnode,
@@ -1924,6 +2009,8 @@ SYSCALL_DEFINE4(get_mempolicy2, struct mpol_param __user *, uparam, size_t, usiz
int err;
nodemask_t policy_nodemask;
unsigned long __user *nodes_ptr;
+ u8 __user *weights_ptr;
+ u8 *weights = NULL;
if (flags & ~(MPOL_F_ADDR))
return -EINVAL;
@@ -1935,6 +2022,13 @@ SYSCALL_DEFINE4(get_mempolicy2, struct mpol_param __user *, uparam, size_t, usiz
if (err)
return -EINVAL;
+ if (kparam.il_weights) {
+ weights = kzalloc(MAX_NUMNODES, GFP_KERNEL | __GFP_NORETRY);
+ if (!weights)
+ return -ENOMEM;
+ }
+ mparam.il_weights = weights;
+
mparam.policy_nodes = kparam.pol_nodes ? &policy_nodemask : NULL;
if (flags & MPOL_F_ADDR)
err = do_get_vma_mempolicy(untagged_addr(addr), NULL, &mparam);
@@ -1942,7 +2036,7 @@ SYSCALL_DEFINE4(get_mempolicy2, struct mpol_param __user *, uparam, size_t, usiz
err = do_get_task_mempolicy(&mparam, NULL);
if (err)
- return err;
+ goto leave_weights;
kparam.mode = mparam.mode;
kparam.mode_flags = mparam.mode_flags;
@@ -1952,10 +2046,21 @@ SYSCALL_DEFINE4(get_mempolicy2, struct mpol_param __user *, uparam, size_t, usiz
err = copy_nodes_to_user(nodes_ptr, kparam.pol_maxnodes,
mparam.policy_nodes);
if (err)
- return err;
+ goto leave_weights;
+ }
+
+ if (kparam.mode == MPOL_WEIGHTED_INTERLEAVE && kparam.il_weights) {
+ weights_ptr = u64_to_user_ptr(kparam.il_weights);
+ if (copy_to_user(weights_ptr, weights, kparam.pol_maxnodes)) {
+ err = -EFAULT;
+ goto leave_weights;
+ }
}
- return copy_to_user(uparam, &kparam, usize) ? -EFAULT : 0;
+ err = copy_to_user(uparam, &kparam, usize) ? -EFAULT : 0;
+leave_weights:
+ kfree(weights);
+ return err;
}
bool vma_migratable(struct vm_area_struct *vma)
@@ -2077,8 +2182,10 @@ static unsigned int weighted_interleave_nodes(struct mempolicy *policy)
return next;
if (!policy->wil.cur_weight) {
- u8 next_weight = iw_table[next];
+ u8 next_weight = policy->wil.weights[next];
+ if (!next_weight)
+ next_weight = iw_table[next];
if (!next_weight)
next_weight = default_iw_table[next];
policy->wil.cur_weight = next_weight;
@@ -2175,8 +2282,10 @@ static unsigned int read_once_interleave_weights(struct mempolicy *pol,
/* Similar issue to read_once_policy_nodemask */
barrier();
for_each_node_mask(nid, *mask) {
- u8 weight = iw_table[nid];
+ u8 weight = pol->wil.weights[nid];
+ if (!weight)
+ weight = iw_table[nid];
if (!weight)
weight = default_iw_table[nid];
weight_total += weight;
@@ -3115,21 +3224,28 @@ void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol)
if (mpol) {
struct sp_node *sn;
struct mempolicy *npol;
+ u8 *weights = NULL;
NODEMASK_SCRATCH(scratch);
if (!scratch)
goto put_mpol;
+ weights = kzalloc(MAX_NUMNODES, GFP_KERNEL | __GFP_NORETRY);
+ if (!weights)
+ goto free_scratch;
+ memcpy(weights, mpol->wil.weights, sizeof(weights));
+
memset(&mparam, 0, sizeof(mparam));
mparam.mode = mpol->mode;
mparam.mode_flags = mpol->flags;
mparam.policy_nodes = &mpol->w.user_nodemask;
mparam.home_node = NUMA_NO_NODE;
+ mparam.il_weights = weights;
/* contextualize the tmpfs mount point mempolicy to this file */
npol = mpol_new(&mparam);
if (IS_ERR(npol))
- goto free_scratch; /* no valid nodemask intersection */
+ goto free_weights; /* no valid nodemask intersection */
task_lock(current);
ret = mpol_set_nodemask(npol, &mpol->w.user_nodemask, scratch);
@@ -3143,6 +3259,8 @@ void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol)
sp_insert(sp, sn);
put_npol:
mpol_put(npol); /* drop initial ref on file's npol */
+free_weights:
+ kfree(weights);
free_scratch:
NODEMASK_SCRATCH_FREE(scratch);
put_mpol:
--
2.39.1
^ permalink raw reply related
* [PATCH v6 11/12] mm/mempolicy: add the mbind2 syscall
From: Gregory Price @ 2024-01-03 22:42 UTC (permalink / raw)
To: linux-mm
Cc: linux-doc, linux-fsdevel, linux-kernel, linux-api, linux-arch,
akpm, arnd, tglx, luto, mingo, bp, dave.hansen, hpa, mhocko, tj,
ying.huang, gregory.price, corbet, rakie.kim, hyeongtak.ji,
honggyu.kim, vtavarespetr, peterz, jgroves, ravis.opensrc,
sthanneeru, emirakhur, Hasan.Maruf, seungjun.ha, Michal Hocko,
Frank van der Linden, Geert Uytterhoeven
In-Reply-To: <20240103224209.2541-1-gregory.price@memverge.com>
mbind2 is an extensible mbind interface which allows a user to
set the mempolicy for one or more address ranges.
Defined as:
mbind2(unsigned long addr, unsigned long len, struct mpol_param *param,
size_t size, unsigned long flags)
addr: address of the memory range to operate on
len: length of the memory range
flags: MPOL_MF_HOME_NODE + original mbind() flags
Input values include the following fields of mpol_param:
mode: The MPOL_* policy (DEFAULT, INTERLEAVE, etc.)
mode_flags: The MPOL_F_* flags that were previously passed in or'd
into the mode. This was split to hopefully allow future
extensions additional mode/flag space.
home_node: if (flags & MPOL_MF_HOME_NODE), set home node of policy
to this otherwise it is ignored.
pol_maxnodes: The max number of nodes described by pol_nodes
pol_nodes: the nodemask to apply for the memory policy
The semantics are otherwise the same as mbind(), except that
the home_node can be set.
Suggested-by: Michal Hocko <mhocko@suse.com>
Suggested-by: Frank van der Linden <fvdl@google.com>
Suggested-by: Vinicius Tavares Petrucci <vtavarespetr@micron.com>
Suggested-by: Rakie Kim <rakie.kim@sk.com>
Suggested-by: Hyeongtak Ji <hyeongtak.ji@sk.com>
Suggested-by: Honggyu Kim <honggyu.kim@sk.com>
Signed-off-by: Gregory Price <gregory.price@memverge.com>
Co-developed-by: Vinicius Tavares Petrucci <vtavarespetr@micron.com>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
.../admin-guide/mm/numa_memory_policy.rst | 12 +++++-
arch/alpha/kernel/syscalls/syscall.tbl | 1 +
arch/arm/tools/syscall.tbl | 1 +
arch/arm64/include/asm/unistd.h | 2 +-
arch/arm64/include/asm/unistd32.h | 2 +
arch/m68k/kernel/syscalls/syscall.tbl | 1 +
arch/microblaze/kernel/syscalls/syscall.tbl | 1 +
arch/mips/kernel/syscalls/syscall_n32.tbl | 1 +
arch/mips/kernel/syscalls/syscall_o32.tbl | 1 +
arch/parisc/kernel/syscalls/syscall.tbl | 1 +
arch/powerpc/kernel/syscalls/syscall.tbl | 1 +
arch/s390/kernel/syscalls/syscall.tbl | 1 +
arch/sh/kernel/syscalls/syscall.tbl | 1 +
arch/sparc/kernel/syscalls/syscall.tbl | 1 +
arch/x86/entry/syscalls/syscall_32.tbl | 1 +
arch/x86/entry/syscalls/syscall_64.tbl | 1 +
arch/xtensa/kernel/syscalls/syscall.tbl | 1 +
include/linux/syscalls.h | 3 ++
include/uapi/asm-generic/unistd.h | 4 +-
include/uapi/linux/mempolicy.h | 5 ++-
kernel/sys_ni.c | 1 +
mm/mempolicy.c | 43 +++++++++++++++++++
.../arch/mips/entry/syscalls/syscall_n64.tbl | 1 +
.../arch/powerpc/entry/syscalls/syscall.tbl | 1 +
.../perf/arch/s390/entry/syscalls/syscall.tbl | 1 +
.../arch/x86/entry/syscalls/syscall_64.tbl | 1 +
26 files changed, 85 insertions(+), 5 deletions(-)
diff --git a/Documentation/admin-guide/mm/numa_memory_policy.rst b/Documentation/admin-guide/mm/numa_memory_policy.rst
index a2ff6e89e48b..66a778d58899 100644
--- a/Documentation/admin-guide/mm/numa_memory_policy.rst
+++ b/Documentation/admin-guide/mm/numa_memory_policy.rst
@@ -476,12 +476,18 @@ Install VMA/Shared Policy for a Range of Task's Address Space::
long mbind(void *start, unsigned long len, int mode,
const unsigned long *nmask, unsigned long maxnode,
unsigned flags);
+ long mbind2(void* start, unsigned long len, struct mpol_param *param,
+ size_t size, unsigned long flags);
mbind() installs the policy specified by (mode, nmask, maxnodes) as a
VMA policy for the range of the calling task's address space specified
by the 'start' and 'len' arguments. Additional actions may be
requested via the 'flags' argument.
+mbind2() is an extended version of mbind() capable of setting extended
+mempolicy features. For example, one can set the home node for the memory
+policy without an additional call to set_mempolicy_home_node().
+
See the mbind(2) man page for more details.
Set home node for a Range of Task's Address Spacec::
@@ -497,6 +503,9 @@ closest to which page allocation will come from. Specifying the home node overri
the default allocation policy to allocate memory close to the local node for an
executing CPU.
+mbind2() also provides a way for the home node to be set at the time the
+mempolicy is set. See the mbind(2) man page for more details.
+
Extended Mempolicy Arguments::
struct mpol_param {
@@ -510,7 +519,8 @@ Extended Mempolicy Arguments::
The extended mempolicy argument structure is defined to allow the mempolicy
interfaces future extensibility without the need for additional system calls.
-Extended interfaces (set_mempolicy2 and get_mempolicy2) use this structure.
+Extended interfaces (set_mempolicy2, get_mempolicy2, and mbind2) use this
+this argument structure.
The core arguments (mode, mode_flags, pol_nodes, and pol_maxnodes) apply to
all interfaces relative to their non-extended counterparts. Each additional
diff --git a/arch/alpha/kernel/syscalls/syscall.tbl b/arch/alpha/kernel/syscalls/syscall.tbl
index 0301a8b0a262..e8239293c35a 100644
--- a/arch/alpha/kernel/syscalls/syscall.tbl
+++ b/arch/alpha/kernel/syscalls/syscall.tbl
@@ -498,3 +498,4 @@
566 common futex_requeue sys_futex_requeue
567 common set_mempolicy2 sys_set_mempolicy2
568 common get_mempolicy2 sys_get_mempolicy2
+569 common mbind2 sys_mbind2
diff --git a/arch/arm/tools/syscall.tbl b/arch/arm/tools/syscall.tbl
index 771a33446e8e..a3f39750257a 100644
--- a/arch/arm/tools/syscall.tbl
+++ b/arch/arm/tools/syscall.tbl
@@ -472,3 +472,4 @@
456 common futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2
458 common get_mempolicy2 sys_get_mempolicy2
+459 common mbind2 sys_mbind2
diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h
index b63f870debaf..abe10a833fcd 100644
--- a/arch/arm64/include/asm/unistd.h
+++ b/arch/arm64/include/asm/unistd.h
@@ -39,7 +39,7 @@
#define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE + 5)
#define __ARM_NR_COMPAT_END (__ARM_NR_COMPAT_BASE + 0x800)
-#define __NR_compat_syscalls 459
+#define __NR_compat_syscalls 460
#endif
#define __ARCH_WANT_SYS_CLONE
diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h
index f8d01007aee0..446b7f034332 100644
--- a/arch/arm64/include/asm/unistd32.h
+++ b/arch/arm64/include/asm/unistd32.h
@@ -923,6 +923,8 @@ __SYSCALL(__NR_futex_requeue, sys_futex_requeue)
__SYSCALL(__NR_set_mempolicy2, sys_set_mempolicy2)
#define __NR_get_mempolicy2 458
__SYSCALL(__NR_get_mempolicy2, sys_get_mempolicy2)
+#define __NR_mbind2 459
+__SYSCALL(__NR_mbind2, sys_mbind2)
/*
* Please add new compat syscalls above this comment and update
diff --git a/arch/m68k/kernel/syscalls/syscall.tbl b/arch/m68k/kernel/syscalls/syscall.tbl
index 048a409e684c..9a12dface18e 100644
--- a/arch/m68k/kernel/syscalls/syscall.tbl
+++ b/arch/m68k/kernel/syscalls/syscall.tbl
@@ -458,3 +458,4 @@
456 common futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2
458 common get_mempolicy2 sys_get_mempolicy2
+459 common mbind2 sys_mbind2
diff --git a/arch/microblaze/kernel/syscalls/syscall.tbl b/arch/microblaze/kernel/syscalls/syscall.tbl
index 327b01bd6793..6cb740123137 100644
--- a/arch/microblaze/kernel/syscalls/syscall.tbl
+++ b/arch/microblaze/kernel/syscalls/syscall.tbl
@@ -464,3 +464,4 @@
456 common futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2
458 common get_mempolicy2 sys_get_mempolicy2
+459 common mbind2 sys_mbind2
diff --git a/arch/mips/kernel/syscalls/syscall_n32.tbl b/arch/mips/kernel/syscalls/syscall_n32.tbl
index 921d58e1da23..52cf720f8ae2 100644
--- a/arch/mips/kernel/syscalls/syscall_n32.tbl
+++ b/arch/mips/kernel/syscalls/syscall_n32.tbl
@@ -397,3 +397,4 @@
456 n32 futex_requeue sys_futex_requeue
457 n32 set_mempolicy2 sys_set_mempolicy2
458 n32 get_mempolicy2 sys_get_mempolicy2
+459 n32 mbind2 sys_mbind2
diff --git a/arch/mips/kernel/syscalls/syscall_o32.tbl b/arch/mips/kernel/syscalls/syscall_o32.tbl
index 9271c83c9993..fd37c5301a48 100644
--- a/arch/mips/kernel/syscalls/syscall_o32.tbl
+++ b/arch/mips/kernel/syscalls/syscall_o32.tbl
@@ -446,3 +446,4 @@
456 o32 futex_requeue sys_futex_requeue
457 o32 set_mempolicy2 sys_set_mempolicy2
458 o32 get_mempolicy2 sys_get_mempolicy2
+459 o32 mbind2 sys_mbind2
diff --git a/arch/parisc/kernel/syscalls/syscall.tbl b/arch/parisc/kernel/syscalls/syscall.tbl
index 0654f3f89fc7..fcd67bc405b1 100644
--- a/arch/parisc/kernel/syscalls/syscall.tbl
+++ b/arch/parisc/kernel/syscalls/syscall.tbl
@@ -457,3 +457,4 @@
456 common futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2
458 common get_mempolicy2 sys_get_mempolicy2
+459 common mbind2 sys_mbind2
diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl b/arch/powerpc/kernel/syscalls/syscall.tbl
index ac11d2064e7a..89715417014c 100644
--- a/arch/powerpc/kernel/syscalls/syscall.tbl
+++ b/arch/powerpc/kernel/syscalls/syscall.tbl
@@ -545,3 +545,4 @@
456 common futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2
458 common get_mempolicy2 sys_get_mempolicy2
+459 common mbind2 sys_mbind2
diff --git a/arch/s390/kernel/syscalls/syscall.tbl b/arch/s390/kernel/syscalls/syscall.tbl
index 1cdcafe1ccca..c8304e0d0aa7 100644
--- a/arch/s390/kernel/syscalls/syscall.tbl
+++ b/arch/s390/kernel/syscalls/syscall.tbl
@@ -461,3 +461,4 @@
456 common futex_requeue sys_futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2 sys_set_mempolicy2
458 common get_mempolicy2 sys_get_mempolicy2 sys_get_mempolicy2
+459 common mbind2 sys_mbind2 sys_mbind2
diff --git a/arch/sh/kernel/syscalls/syscall.tbl b/arch/sh/kernel/syscalls/syscall.tbl
index f71742024c29..e5c51b6c367f 100644
--- a/arch/sh/kernel/syscalls/syscall.tbl
+++ b/arch/sh/kernel/syscalls/syscall.tbl
@@ -461,3 +461,4 @@
456 common futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2
458 common get_mempolicy2 sys_get_mempolicy2
+459 common mbind2 sys_mbind2
diff --git a/arch/sparc/kernel/syscalls/syscall.tbl b/arch/sparc/kernel/syscalls/syscall.tbl
index 2fbf5dbe0620..74527f585500 100644
--- a/arch/sparc/kernel/syscalls/syscall.tbl
+++ b/arch/sparc/kernel/syscalls/syscall.tbl
@@ -504,3 +504,4 @@
456 common futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2
458 common get_mempolicy2 sys_get_mempolicy2
+459 common mbind2 sys_mbind2
diff --git a/arch/x86/entry/syscalls/syscall_32.tbl b/arch/x86/entry/syscalls/syscall_32.tbl
index 0af813b9a118..be2e2aa17dd8 100644
--- a/arch/x86/entry/syscalls/syscall_32.tbl
+++ b/arch/x86/entry/syscalls/syscall_32.tbl
@@ -463,3 +463,4 @@
456 i386 futex_requeue sys_futex_requeue
457 i386 set_mempolicy2 sys_set_mempolicy2
458 i386 get_mempolicy2 sys_get_mempolicy2
+459 i386 mbind2 sys_mbind2
diff --git a/arch/x86/entry/syscalls/syscall_64.tbl b/arch/x86/entry/syscalls/syscall_64.tbl
index 0b777876fc15..6e2347eb8773 100644
--- a/arch/x86/entry/syscalls/syscall_64.tbl
+++ b/arch/x86/entry/syscalls/syscall_64.tbl
@@ -380,6 +380,7 @@
456 common futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2
458 common get_mempolicy2 sys_get_mempolicy2
+459 common mbind2 sys_mbind2
#
# Due to a historical design error, certain syscalls are numbered differently
diff --git a/arch/xtensa/kernel/syscalls/syscall.tbl b/arch/xtensa/kernel/syscalls/syscall.tbl
index 4536c9a4227d..f00a21317dc0 100644
--- a/arch/xtensa/kernel/syscalls/syscall.tbl
+++ b/arch/xtensa/kernel/syscalls/syscall.tbl
@@ -429,3 +429,4 @@
456 common futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2
458 common get_mempolicy2 sys_get_mempolicy2
+459 common mbind2 sys_mbind2
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index c4dc5069bae7..02f5c1e94ae5 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -817,6 +817,9 @@ asmlinkage long sys_mbind(unsigned long start, unsigned long len,
const unsigned long __user *nmask,
unsigned long maxnode,
unsigned flags);
+asmlinkage long sys_mbind2(unsigned long start, unsigned long len,
+ const struct mpol_param __user *param, size_t usize,
+ unsigned long flags);
asmlinkage long sys_get_mempolicy(int __user *policy,
unsigned long __user *nmask,
unsigned long maxnode,
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
index 719accc731db..cd31599bb9cc 100644
--- a/include/uapi/asm-generic/unistd.h
+++ b/include/uapi/asm-generic/unistd.h
@@ -832,9 +832,11 @@ __SYSCALL(__NR_futex_requeue, sys_futex_requeue)
__SYSCALL(__NR_set_mempolicy2, sys_set_mempolicy2)
#define __NR_get_mempolicy2 458
__SYSCALL(__NR_get_mempolicy2, sys_get_mempolicy2)
+#define __NR_mbind2 459
+__SYSCALL(__NR_mbind2, sys_mbind2)
#undef __NR_syscalls
-#define __NR_syscalls 459
+#define __NR_syscalls 460
/*
* 32 bit systems traditionally used different
diff --git a/include/uapi/linux/mempolicy.h b/include/uapi/linux/mempolicy.h
index 109788c8be92..7c7c384479fc 100644
--- a/include/uapi/linux/mempolicy.h
+++ b/include/uapi/linux/mempolicy.h
@@ -53,13 +53,14 @@ struct mpol_param {
#define MPOL_F_ADDR (1<<1) /* look up vma using address */
#define MPOL_F_MEMS_ALLOWED (1<<2) /* return allowed memories */
-/* Flags for mbind */
+/* Flags for mbind/mbind2 */
#define MPOL_MF_STRICT (1<<0) /* Verify existing pages in the mapping */
#define MPOL_MF_MOVE (1<<1) /* Move pages owned by this process to conform
to policy */
#define MPOL_MF_MOVE_ALL (1<<2) /* Move every page to conform to policy */
#define MPOL_MF_LAZY (1<<3) /* UNSUPPORTED FLAG: Lazy migrate on fault */
-#define MPOL_MF_INTERNAL (1<<4) /* Internal flags start here */
+#define MPOL_MF_HOME_NODE (1<<4) /* mbind2: set home node */
+#define MPOL_MF_INTERNAL (1<<5) /* Internal flags start here */
#define MPOL_MF_VALID (MPOL_MF_STRICT | \
MPOL_MF_MOVE | \
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index 6afbd3a41319..2483b5afa99f 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -187,6 +187,7 @@ COND_SYSCALL(process_madvise);
COND_SYSCALL(process_mrelease);
COND_SYSCALL(remap_file_pages);
COND_SYSCALL(mbind);
+COND_SYSCALL(mbind2);
COND_SYSCALL(get_mempolicy);
COND_SYSCALL(get_mempolicy2);
COND_SYSCALL(set_mempolicy);
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 0b2e31d8636d..53301e173c90 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1612,6 +1612,49 @@ SYSCALL_DEFINE6(mbind, unsigned long, start, unsigned long, len,
return kernel_mbind(start, len, mode, nmask, maxnode, flags);
}
+SYSCALL_DEFINE5(mbind2, unsigned long, start, unsigned long, len,
+ const struct mpol_param __user *, uparam, size_t, usize,
+ unsigned long, flags)
+{
+ struct mpol_param kparam;
+ struct mempolicy_param mparam;
+ nodemask_t policy_nodes;
+ unsigned long __user *nodes_ptr;
+ int err;
+
+ if (!start || !len)
+ return -EINVAL;
+
+ err = copy_struct_from_user(&kparam, sizeof(kparam), uparam, usize);
+ if (err)
+ return -EINVAL;
+
+ err = validate_mpol_flags(kparam.mode, &kparam.mode_flags);
+ if (err)
+ return err;
+
+ mparam.mode = kparam.mode;
+ mparam.mode_flags = kparam.mode_flags;
+
+ /* if home node given, validate it is online */
+ if (flags & MPOL_MF_HOME_NODE) {
+ if ((kparam.home_node >= MAX_NUMNODES) ||
+ !node_online(kparam.home_node))
+ return -EINVAL;
+ mparam.home_node = kparam.home_node;
+ } else
+ mparam.home_node = NUMA_NO_NODE;
+ flags &= ~MPOL_MF_HOME_NODE;
+
+ nodes_ptr = u64_to_user_ptr(kparam.pol_nodes);
+ err = get_nodes(&policy_nodes, nodes_ptr, kparam.pol_maxnodes);
+ if (err)
+ return err;
+ mparam.policy_nodes = &policy_nodes;
+
+ return do_mbind(untagged_addr(start), len, &mparam, flags);
+}
+
/* Set the process memory policy */
static long kernel_set_mempolicy(int mode, const unsigned long __user *nmask,
unsigned long maxnode)
diff --git a/tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl b/tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl
index c34c6877379e..4fd9f742d903 100644
--- a/tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl
+++ b/tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl
@@ -373,3 +373,4 @@
456 n64 futex_requeue sys_futex_requeue
457 n64 set_mempolicy2 sys_set_mempolicy2
458 n64 get_mempolicy2 sys_get_mempolicy2
+459 n64 mbind2 sys_mbind2
diff --git a/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl b/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
index ac11d2064e7a..89715417014c 100644
--- a/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
+++ b/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
@@ -545,3 +545,4 @@
456 common futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2
458 common get_mempolicy2 sys_get_mempolicy2
+459 common mbind2 sys_mbind2
diff --git a/tools/perf/arch/s390/entry/syscalls/syscall.tbl b/tools/perf/arch/s390/entry/syscalls/syscall.tbl
index 1cdcafe1ccca..c8304e0d0aa7 100644
--- a/tools/perf/arch/s390/entry/syscalls/syscall.tbl
+++ b/tools/perf/arch/s390/entry/syscalls/syscall.tbl
@@ -461,3 +461,4 @@
456 common futex_requeue sys_futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2 sys_set_mempolicy2
458 common get_mempolicy2 sys_get_mempolicy2 sys_get_mempolicy2
+459 common mbind2 sys_mbind2 sys_mbind2
diff --git a/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl b/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
index edf338f32645..3fc74241da5d 100644
--- a/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
+++ b/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
@@ -380,6 +380,7 @@
456 common futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2
458 common get_mempolicy2 sys_get_mempolicy2
+459 common mbind2 sys_mbind2
#
# Due to a historical design error, certain syscalls are numbered differently
--
2.39.1
^ permalink raw reply related
* [PATCH v6 10/12] mm/mempolicy: add get_mempolicy2 syscall
From: Gregory Price @ 2024-01-03 22:42 UTC (permalink / raw)
To: linux-mm
Cc: linux-doc, linux-fsdevel, linux-kernel, linux-api, linux-arch,
akpm, arnd, tglx, luto, mingo, bp, dave.hansen, hpa, mhocko, tj,
ying.huang, gregory.price, corbet, rakie.kim, hyeongtak.ji,
honggyu.kim, vtavarespetr, peterz, jgroves, ravis.opensrc,
sthanneeru, emirakhur, Hasan.Maruf, seungjun.ha, Michal Hocko,
Geert Uytterhoeven
In-Reply-To: <20240103224209.2541-1-gregory.price@memverge.com>
get_mempolicy2 is an extensible get_mempolicy interface which allows
a user to retrieve the memory policy for a task or address.
Defined as:
get_mempolicy2(struct mpol_param *param, size_t size,
unsigned long addr, unsigned long flags)
Top level input values:
mpol_param: The field which collects information about the mempolicy
returned to userspace.
addr: if MPOL_F_ADDR is passed in `flags`, this address will be
used to return the mempolicy details of the vma the
address belongs to
flags: if MPOL_F_ADDR, return mempolicy info vma containing addr
else, returns task mempolicy information
Input values include the following fields of mpol_param:
pol_maxnodes: if pol_nodes is set, must describe max number of nodes
to be copied to pol_nodes
pol_nodes: if set, the nodemask of the policy returned here
Output values include the following fields of mpol_param:
mode: mempolicy mode
mode_flags: mempolicy mode flags
home_node: policy home node will be returned here, or -1 if not.
pol_nodes: if set, the nodemask for the mempolicy
MPOL_F_NODE has been dropped from get_mempolicy2 (EINVAL).
MPOL_F_NODE originally allowed for either the ability to acquire
the node the page of `addr` is presently allocated on - or, if
addr is not provided and the policy mode is MPOL_INTERLEAVE - it
would return the node that would be used for the next allocation.
Neither of these capabilities were pulled forward into get_mempolicy2
a) both are still possible to acquire via get_mempolicy()
b) both of pieces of data are racey by definition and have not
proven useful.
c) Should such a use be identified, it can be easily added back
into mempolicy2 as an extension.
MPOL_F_MEMS_ALLOWED has been dropped from get_mempolicy2 (EINVAL).
MPOL_F_MEMS_ALLOWED originally returned the task->mems_allowed
nodemask in the nodemask parameter instead of the task or vma
nodemask.
a) this is still accessible from get_mempolicy()
b) task->mems_allowed is not technically part of mempolicy,
though it is related.
c) should this warrant bringing forward (in the scenario
where get_mempolicy is deprecated), it can be added as
an explicit extension. Or more smartly: implemented as
its own syscall.
Suggested-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Gregory Price <gregory.price@memverge.com>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
.../admin-guide/mm/numa_memory_policy.rst | 11 ++++-
arch/alpha/kernel/syscalls/syscall.tbl | 1 +
arch/arm/tools/syscall.tbl | 1 +
arch/arm64/include/asm/unistd.h | 2 +-
arch/arm64/include/asm/unistd32.h | 2 +
arch/m68k/kernel/syscalls/syscall.tbl | 1 +
arch/microblaze/kernel/syscalls/syscall.tbl | 1 +
arch/mips/kernel/syscalls/syscall_n32.tbl | 1 +
arch/mips/kernel/syscalls/syscall_o32.tbl | 1 +
arch/parisc/kernel/syscalls/syscall.tbl | 1 +
arch/powerpc/kernel/syscalls/syscall.tbl | 1 +
arch/s390/kernel/syscalls/syscall.tbl | 1 +
arch/sh/kernel/syscalls/syscall.tbl | 1 +
arch/sparc/kernel/syscalls/syscall.tbl | 1 +
arch/x86/entry/syscalls/syscall_32.tbl | 1 +
arch/x86/entry/syscalls/syscall_64.tbl | 1 +
arch/xtensa/kernel/syscalls/syscall.tbl | 1 +
include/linux/syscalls.h | 2 +
include/uapi/asm-generic/unistd.h | 4 +-
kernel/sys_ni.c | 1 +
mm/mempolicy.c | 42 +++++++++++++++++++
.../arch/mips/entry/syscalls/syscall_n64.tbl | 1 +
.../arch/powerpc/entry/syscalls/syscall.tbl | 1 +
.../perf/arch/s390/entry/syscalls/syscall.tbl | 1 +
.../arch/x86/entry/syscalls/syscall_64.tbl | 1 +
25 files changed, 79 insertions(+), 3 deletions(-)
diff --git a/Documentation/admin-guide/mm/numa_memory_policy.rst b/Documentation/admin-guide/mm/numa_memory_policy.rst
index 62a4ea14c646..a2ff6e89e48b 100644
--- a/Documentation/admin-guide/mm/numa_memory_policy.rst
+++ b/Documentation/admin-guide/mm/numa_memory_policy.rst
@@ -454,11 +454,20 @@ Get [Task] Memory Policy or Related Information::
long get_mempolicy(int *mode,
const unsigned long *nmask, unsigned long maxnode,
void *addr, int flags);
+ long get_mempolicy2(struct mpol_param *param, size_t size,
+ unsigned long addr, unsigned long flags);
Queries the "task/process memory policy" of the calling task, or the
policy or location of a specified virtual address, depending on the
'flags' argument.
+get_mempolicy2() is an extended version of get_mempolicy() capable of
+acquiring extended information about a mempolicy, including those
+that can only be set via set_mempolicy2() or mbind2().
+
+MPOL_F_NODE functionality has been removed from get_mempolicy2(),
+but can still be accessed via get_mempolicy().
+
See the get_mempolicy(2) man page for more details
@@ -501,7 +510,7 @@ Extended Mempolicy Arguments::
The extended mempolicy argument structure is defined to allow the mempolicy
interfaces future extensibility without the need for additional system calls.
-Extended interfaces (set_mempolicy2) use this argument structure.
+Extended interfaces (set_mempolicy2 and get_mempolicy2) use this structure.
The core arguments (mode, mode_flags, pol_nodes, and pol_maxnodes) apply to
all interfaces relative to their non-extended counterparts. Each additional
diff --git a/arch/alpha/kernel/syscalls/syscall.tbl b/arch/alpha/kernel/syscalls/syscall.tbl
index 0dc288a1118a..0301a8b0a262 100644
--- a/arch/alpha/kernel/syscalls/syscall.tbl
+++ b/arch/alpha/kernel/syscalls/syscall.tbl
@@ -497,3 +497,4 @@
565 common futex_wait sys_futex_wait
566 common futex_requeue sys_futex_requeue
567 common set_mempolicy2 sys_set_mempolicy2
+568 common get_mempolicy2 sys_get_mempolicy2
diff --git a/arch/arm/tools/syscall.tbl b/arch/arm/tools/syscall.tbl
index 50172ec0e1f5..771a33446e8e 100644
--- a/arch/arm/tools/syscall.tbl
+++ b/arch/arm/tools/syscall.tbl
@@ -471,3 +471,4 @@
455 common futex_wait sys_futex_wait
456 common futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2
+458 common get_mempolicy2 sys_get_mempolicy2
diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h
index 298313d2e0af..b63f870debaf 100644
--- a/arch/arm64/include/asm/unistd.h
+++ b/arch/arm64/include/asm/unistd.h
@@ -39,7 +39,7 @@
#define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE + 5)
#define __ARM_NR_COMPAT_END (__ARM_NR_COMPAT_BASE + 0x800)
-#define __NR_compat_syscalls 458
+#define __NR_compat_syscalls 459
#endif
#define __ARCH_WANT_SYS_CLONE
diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h
index cee8d669c342..f8d01007aee0 100644
--- a/arch/arm64/include/asm/unistd32.h
+++ b/arch/arm64/include/asm/unistd32.h
@@ -921,6 +921,8 @@ __SYSCALL(__NR_futex_wait, sys_futex_wait)
__SYSCALL(__NR_futex_requeue, sys_futex_requeue)
#define __NR_set_mempolicy2 457
__SYSCALL(__NR_set_mempolicy2, sys_set_mempolicy2)
+#define __NR_get_mempolicy2 458
+__SYSCALL(__NR_get_mempolicy2, sys_get_mempolicy2)
/*
* Please add new compat syscalls above this comment and update
diff --git a/arch/m68k/kernel/syscalls/syscall.tbl b/arch/m68k/kernel/syscalls/syscall.tbl
index 839d90c535f2..048a409e684c 100644
--- a/arch/m68k/kernel/syscalls/syscall.tbl
+++ b/arch/m68k/kernel/syscalls/syscall.tbl
@@ -457,3 +457,4 @@
455 common futex_wait sys_futex_wait
456 common futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2
+458 common get_mempolicy2 sys_get_mempolicy2
diff --git a/arch/microblaze/kernel/syscalls/syscall.tbl b/arch/microblaze/kernel/syscalls/syscall.tbl
index 567c8b883735..327b01bd6793 100644
--- a/arch/microblaze/kernel/syscalls/syscall.tbl
+++ b/arch/microblaze/kernel/syscalls/syscall.tbl
@@ -463,3 +463,4 @@
455 common futex_wait sys_futex_wait
456 common futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2
+458 common get_mempolicy2 sys_get_mempolicy2
diff --git a/arch/mips/kernel/syscalls/syscall_n32.tbl b/arch/mips/kernel/syscalls/syscall_n32.tbl
index cc0640e16f2f..921d58e1da23 100644
--- a/arch/mips/kernel/syscalls/syscall_n32.tbl
+++ b/arch/mips/kernel/syscalls/syscall_n32.tbl
@@ -396,3 +396,4 @@
455 n32 futex_wait sys_futex_wait
456 n32 futex_requeue sys_futex_requeue
457 n32 set_mempolicy2 sys_set_mempolicy2
+458 n32 get_mempolicy2 sys_get_mempolicy2
diff --git a/arch/mips/kernel/syscalls/syscall_o32.tbl b/arch/mips/kernel/syscalls/syscall_o32.tbl
index f7262fde98d9..9271c83c9993 100644
--- a/arch/mips/kernel/syscalls/syscall_o32.tbl
+++ b/arch/mips/kernel/syscalls/syscall_o32.tbl
@@ -445,3 +445,4 @@
455 o32 futex_wait sys_futex_wait
456 o32 futex_requeue sys_futex_requeue
457 o32 set_mempolicy2 sys_set_mempolicy2
+458 o32 get_mempolicy2 sys_get_mempolicy2
diff --git a/arch/parisc/kernel/syscalls/syscall.tbl b/arch/parisc/kernel/syscalls/syscall.tbl
index e10f0e8bd064..0654f3f89fc7 100644
--- a/arch/parisc/kernel/syscalls/syscall.tbl
+++ b/arch/parisc/kernel/syscalls/syscall.tbl
@@ -456,3 +456,4 @@
455 common futex_wait sys_futex_wait
456 common futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2
+458 common get_mempolicy2 sys_get_mempolicy2
diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl b/arch/powerpc/kernel/syscalls/syscall.tbl
index 4f03f5f42b78..ac11d2064e7a 100644
--- a/arch/powerpc/kernel/syscalls/syscall.tbl
+++ b/arch/powerpc/kernel/syscalls/syscall.tbl
@@ -544,3 +544,4 @@
455 common futex_wait sys_futex_wait
456 common futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2
+458 common get_mempolicy2 sys_get_mempolicy2
diff --git a/arch/s390/kernel/syscalls/syscall.tbl b/arch/s390/kernel/syscalls/syscall.tbl
index f98dadc2e9df..1cdcafe1ccca 100644
--- a/arch/s390/kernel/syscalls/syscall.tbl
+++ b/arch/s390/kernel/syscalls/syscall.tbl
@@ -460,3 +460,4 @@
455 common futex_wait sys_futex_wait sys_futex_wait
456 common futex_requeue sys_futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2 sys_set_mempolicy2
+458 common get_mempolicy2 sys_get_mempolicy2 sys_get_mempolicy2
diff --git a/arch/sh/kernel/syscalls/syscall.tbl b/arch/sh/kernel/syscalls/syscall.tbl
index f47ba9f2d05d..f71742024c29 100644
--- a/arch/sh/kernel/syscalls/syscall.tbl
+++ b/arch/sh/kernel/syscalls/syscall.tbl
@@ -460,3 +460,4 @@
455 common futex_wait sys_futex_wait
456 common futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2
+458 common get_mempolicy2 sys_get_mempolicy2
diff --git a/arch/sparc/kernel/syscalls/syscall.tbl b/arch/sparc/kernel/syscalls/syscall.tbl
index 53fb16616728..2fbf5dbe0620 100644
--- a/arch/sparc/kernel/syscalls/syscall.tbl
+++ b/arch/sparc/kernel/syscalls/syscall.tbl
@@ -503,3 +503,4 @@
455 common futex_wait sys_futex_wait
456 common futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2
+458 common get_mempolicy2 sys_get_mempolicy2
diff --git a/arch/x86/entry/syscalls/syscall_32.tbl b/arch/x86/entry/syscalls/syscall_32.tbl
index 4b4dc41b24ee..0af813b9a118 100644
--- a/arch/x86/entry/syscalls/syscall_32.tbl
+++ b/arch/x86/entry/syscalls/syscall_32.tbl
@@ -462,3 +462,4 @@
455 i386 futex_wait sys_futex_wait
456 i386 futex_requeue sys_futex_requeue
457 i386 set_mempolicy2 sys_set_mempolicy2
+458 i386 get_mempolicy2 sys_get_mempolicy2
diff --git a/arch/x86/entry/syscalls/syscall_64.tbl b/arch/x86/entry/syscalls/syscall_64.tbl
index 1bc2190bec27..0b777876fc15 100644
--- a/arch/x86/entry/syscalls/syscall_64.tbl
+++ b/arch/x86/entry/syscalls/syscall_64.tbl
@@ -379,6 +379,7 @@
455 common futex_wait sys_futex_wait
456 common futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2
+458 common get_mempolicy2 sys_get_mempolicy2
#
# Due to a historical design error, certain syscalls are numbered differently
diff --git a/arch/xtensa/kernel/syscalls/syscall.tbl b/arch/xtensa/kernel/syscalls/syscall.tbl
index e26dc89399eb..4536c9a4227d 100644
--- a/arch/xtensa/kernel/syscalls/syscall.tbl
+++ b/arch/xtensa/kernel/syscalls/syscall.tbl
@@ -428,3 +428,4 @@
455 common futex_wait sys_futex_wait
456 common futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2
+458 common get_mempolicy2 sys_get_mempolicy2
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index b37ea6715456..c4dc5069bae7 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -821,6 +821,8 @@ asmlinkage long sys_get_mempolicy(int __user *policy,
unsigned long __user *nmask,
unsigned long maxnode,
unsigned long addr, unsigned long flags);
+asmlinkage long sys_get_mempolicy2(struct mpol_param __user *param, size_t size,
+ unsigned long addr, unsigned long flags);
asmlinkage long sys_set_mempolicy(int mode, const unsigned long __user *nmask,
unsigned long maxnode);
asmlinkage long sys_set_mempolicy2(struct mpol_param __user *param, size_t size,
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
index 55486aba099f..719accc731db 100644
--- a/include/uapi/asm-generic/unistd.h
+++ b/include/uapi/asm-generic/unistd.h
@@ -830,9 +830,11 @@ __SYSCALL(__NR_futex_wait, sys_futex_wait)
__SYSCALL(__NR_futex_requeue, sys_futex_requeue)
#define __NR_set_mempolicy2 457
__SYSCALL(__NR_set_mempolicy2, sys_set_mempolicy2)
+#define __NR_get_mempolicy2 458
+__SYSCALL(__NR_get_mempolicy2, sys_get_mempolicy2)
#undef __NR_syscalls
-#define __NR_syscalls 458
+#define __NR_syscalls 459
/*
* 32 bit systems traditionally used different
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index fa1373c8bff8..6afbd3a41319 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -188,6 +188,7 @@ COND_SYSCALL(process_mrelease);
COND_SYSCALL(remap_file_pages);
COND_SYSCALL(mbind);
COND_SYSCALL(get_mempolicy);
+COND_SYSCALL(get_mempolicy2);
COND_SYSCALL(set_mempolicy);
COND_SYSCALL(set_mempolicy2);
COND_SYSCALL(migrate_pages);
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 84d877195deb..0b2e31d8636d 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1873,6 +1873,48 @@ SYSCALL_DEFINE5(get_mempolicy, int __user *, policy,
return kernel_get_mempolicy(policy, nmask, maxnode, addr, flags);
}
+SYSCALL_DEFINE4(get_mempolicy2, struct mpol_param __user *, uparam, size_t, usize,
+ unsigned long, addr, unsigned long, flags)
+{
+ struct mpol_param kparam;
+ struct mempolicy_param mparam;
+ int err;
+ nodemask_t policy_nodemask;
+ unsigned long __user *nodes_ptr;
+
+ if (flags & ~(MPOL_F_ADDR))
+ return -EINVAL;
+
+ /* initialize any memory liable to be copied to userland */
+ memset(&mparam, 0, sizeof(mparam));
+
+ err = copy_struct_from_user(&kparam, sizeof(kparam), uparam, usize);
+ if (err)
+ return -EINVAL;
+
+ mparam.policy_nodes = kparam.pol_nodes ? &policy_nodemask : NULL;
+ if (flags & MPOL_F_ADDR)
+ err = do_get_vma_mempolicy(untagged_addr(addr), NULL, &mparam);
+ else
+ err = do_get_task_mempolicy(&mparam, NULL);
+
+ if (err)
+ return err;
+
+ kparam.mode = mparam.mode;
+ kparam.mode_flags = mparam.mode_flags;
+ kparam.home_node = mparam.home_node;
+ if (kparam.pol_nodes) {
+ nodes_ptr = u64_to_user_ptr(kparam.pol_nodes);
+ err = copy_nodes_to_user(nodes_ptr, kparam.pol_maxnodes,
+ mparam.policy_nodes);
+ if (err)
+ return err;
+ }
+
+ return copy_to_user(uparam, &kparam, usize) ? -EFAULT : 0;
+}
+
bool vma_migratable(struct vm_area_struct *vma)
{
if (vma->vm_flags & (VM_IO | VM_PFNMAP))
diff --git a/tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl b/tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl
index bb1351df51d9..c34c6877379e 100644
--- a/tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl
+++ b/tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl
@@ -372,3 +372,4 @@
455 n64 futex_wait sys_futex_wait
456 n64 futex_requeue sys_futex_requeue
457 n64 set_mempolicy2 sys_set_mempolicy2
+458 n64 get_mempolicy2 sys_get_mempolicy2
diff --git a/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl b/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
index 4f03f5f42b78..ac11d2064e7a 100644
--- a/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
+++ b/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
@@ -544,3 +544,4 @@
455 common futex_wait sys_futex_wait
456 common futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2
+458 common get_mempolicy2 sys_get_mempolicy2
diff --git a/tools/perf/arch/s390/entry/syscalls/syscall.tbl b/tools/perf/arch/s390/entry/syscalls/syscall.tbl
index f98dadc2e9df..1cdcafe1ccca 100644
--- a/tools/perf/arch/s390/entry/syscalls/syscall.tbl
+++ b/tools/perf/arch/s390/entry/syscalls/syscall.tbl
@@ -460,3 +460,4 @@
455 common futex_wait sys_futex_wait sys_futex_wait
456 common futex_requeue sys_futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2 sys_set_mempolicy2
+458 common get_mempolicy2 sys_get_mempolicy2 sys_get_mempolicy2
diff --git a/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl b/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
index 21f2579679d4..edf338f32645 100644
--- a/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
+++ b/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
@@ -379,6 +379,7 @@
455 common futex_wait sys_futex_wait
456 common futex_requeue sys_futex_requeue
457 common set_mempolicy2 sys_set_mempolicy2
+458 common get_mempolicy2 sys_get_mempolicy2
#
# Due to a historical design error, certain syscalls are numbered differently
--
2.39.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox