Linus Torvalds
3bf03b9a08
Merge branch 'akpm' (patches from Andrew)
...
Merge updates from Andrew Morton:
- A few misc subsystems: kthread, scripts, ntfs, ocfs2, block, and vfs
- Most the MM patches which precede the patches in Willy's tree: kasan,
pagecache, gup, swap, shmem, memcg, selftests, pagemap, mremap,
sparsemem, vmalloc, pagealloc, memory-failure, mlock, hugetlb,
userfaultfd, vmscan, compaction, mempolicy, oom-kill, migration, thp,
cma, autonuma, psi, ksm, page-poison, madvise, memory-hotplug, rmap,
zswap, uaccess, ioremap, highmem, cleanups, kfence, hmm, and damon.
* emailed patches from Andrew Morton <akpm@linux-foundation.org >: (227 commits)
mm/damon/sysfs: remove repeat container_of() in damon_sysfs_kdamond_release()
Docs/ABI/testing: add DAMON sysfs interface ABI document
Docs/admin-guide/mm/damon/usage: document DAMON sysfs interface
selftests/damon: add a test for DAMON sysfs interface
mm/damon/sysfs: support DAMOS stats
mm/damon/sysfs: support DAMOS watermarks
mm/damon/sysfs: support schemes prioritization
mm/damon/sysfs: support DAMOS quotas
mm/damon/sysfs: support DAMON-based Operation Schemes
mm/damon/sysfs: support the physical address space monitoring
mm/damon/sysfs: link DAMON for virtual address spaces monitoring
mm/damon: implement a minimal stub for sysfs-based DAMON interface
mm/damon/core: add number of each enum type values
mm/damon/core: allow non-exclusive DAMON start/stop
Docs/damon: update outdated term 'regions update interval'
Docs/vm/damon/design: update DAMON-Idle Page Tracking interference handling
Docs/vm/damon: call low level monitoring primitives the operations
mm/damon: remove unnecessary CONFIG_DAMON option
mm/damon/paddr,vaddr: remove damon_{p,v}a_{target_valid,set_operations}()
mm/damon/dbgfs-test: fix is_target_id() change
...
2022-03-22 16:11:53 -07:00
Huang Ying
c574bbe917
NUMA balancing: optimize page placement for memory tiering system
...
With the advent of various new memory types, some machines will have
multiple types of memory, e.g. DRAM and PMEM (persistent memory). The
memory subsystem of these machines can be called memory tiering system,
because the performance of the different types of memory are usually
different.
In such system, because of the memory accessing pattern changing etc,
some pages in the slow memory may become hot globally. So in this
patch, the NUMA balancing mechanism is enhanced to optimize the page
placement among the different memory types according to hot/cold
dynamically.
In a typical memory tiering system, there are CPUs, fast memory and slow
memory in each physical NUMA node. The CPUs and the fast memory will be
put in one logical node (called fast memory node), while the slow memory
will be put in another (faked) logical node (called slow memory node).
That is, the fast memory is regarded as local while the slow memory is
regarded as remote. So it's possible for the recently accessed pages in
the slow memory node to be promoted to the fast memory node via the
existing NUMA balancing mechanism.
The original NUMA balancing mechanism will stop to migrate pages if the
free memory of the target node becomes below the high watermark. This
is a reasonable policy if there's only one memory type. But this makes
the original NUMA balancing mechanism almost do not work to optimize
page placement among different memory types. Details are as follows.
It's the common cases that the working-set size of the workload is
larger than the size of the fast memory nodes. Otherwise, it's
unnecessary to use the slow memory at all. So, there are almost always
no enough free pages in the fast memory nodes, so that the globally hot
pages in the slow memory node cannot be promoted to the fast memory
node. To solve the issue, we have 2 choices as follows,
a. Ignore the free pages watermark checking when promoting hot pages
from the slow memory node to the fast memory node. This will
create some memory pressure in the fast memory node, thus trigger
the memory reclaiming. So that, the cold pages in the fast memory
node will be demoted to the slow memory node.
b. Define a new watermark called wmark_promo which is higher than
wmark_high, and have kswapd reclaiming pages until free pages reach
such watermark. The scenario is as follows: when we want to promote
hot-pages from a slow memory to a fast memory, but fast memory's free
pages would go lower than high watermark with such promotion, we wake
up kswapd with wmark_promo watermark in order to demote cold pages and
free us up some space. So, next time we want to promote hot-pages we
might have a chance of doing so.
The choice "a" may create high memory pressure in the fast memory node.
If the memory pressure of the workload is high, the memory pressure
may become so high that the memory allocation latency of the workload
is influenced, e.g. the direct reclaiming may be triggered.
The choice "b" works much better at this aspect. If the memory
pressure of the workload is high, the hot pages promotion will stop
earlier because its allocation watermark is higher than that of the
normal memory allocation. So in this patch, choice "b" is implemented.
A new zone watermark (WMARK_PROMO) is added. Which is larger than the
high watermark and can be controlled via watermark_scale_factor.
In addition to the original page placement optimization among sockets,
the NUMA balancing mechanism is extended to be used to optimize page
placement according to hot/cold among different memory types. So the
sysctl user space interface (numa_balancing) is extended in a backward
compatible way as follow, so that the users can enable/disable these
functionality individually.
The sysctl is converted from a Boolean value to a bits field. The
definition of the flags is,
- 0: NUMA_BALANCING_DISABLED
- 1: NUMA_BALANCING_NORMAL
- 2: NUMA_BALANCING_MEMORY_TIERING
We have tested the patch with the pmbench memory accessing benchmark
with the 80:20 read/write ratio and the Gauss access address
distribution on a 2 socket Intel server with Optane DC Persistent
Memory Model. The test results shows that the pmbench score can
improve up to 95.9%.
Thanks Andrew Morton to help fix the document format error.
Link: https://lkml.kernel.org/r/20220221084529.1052339-3-ying.huang@intel.com
Signed-off-by: "Huang, Ying" <ying.huang@intel.com >
Tested-by: Baolin Wang <baolin.wang@linux.alibaba.com >
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com >
Acked-by: Johannes Weiner <hannes@cmpxchg.org >
Reviewed-by: Oscar Salvador <osalvador@suse.de >
Reviewed-by: Yang Shi <shy828301@gmail.com >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Rik van Riel <riel@surriel.com >
Cc: Mel Gorman <mgorman@techsingularity.net >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Zi Yan <ziy@nvidia.com >
Cc: Wei Xu <weixugc@google.com >
Cc: Shakeel Butt <shakeelb@google.com >
Cc: zhongjiang-ali <zhongjiang-ali@linux.alibaba.com >
Cc: Randy Dunlap <rdunlap@infradead.org >
Cc: Feng Tang <feng.tang@intel.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-03-22 15:57:09 -07:00
Ingo Molnar
ccdbf33c23
Merge tag 'v5.17-rc8' into sched/core, to pick up fixes
...
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2022-03-15 10:28:12 +01:00
Josh Poimboeuf
44a3918c82
x86/speculation: Include unprivileged eBPF status in Spectre v2 mitigation reporting
...
With unprivileged eBPF enabled, eIBRS (without retpoline) is vulnerable
to Spectre v2 BHB-based attacks.
When both are enabled, print a warning message and report it in the
'spectre_v2' sysfs vulnerabilities file.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com >
Signed-off-by: Borislav Petkov <bp@suse.de >
Reviewed-by: Thomas Gleixner <tglx@linutronix.de >
2022-02-21 10:21:47 +01:00
Zhen Ni
c8eaf6ac76
sched: move autogroup sysctls into its own file
...
move autogroup sysctls to autogroup.c and use the new
register_sysctl_init() to register the sysctl interface.
Signed-off-by: Zhen Ni <nizhen@uniontech.com >
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Link: https://lkml.kernel.org/r/20220128095025.8745-1-nizhen@uniontech.com
2022-02-02 13:11:37 +01:00
Baokun Li
1622ed7d07
sysctl: returns -EINVAL when a negative value is passed to proc_doulongvec_minmax
...
When we pass a negative value to the proc_doulongvec_minmax() function,
the function returns 0, but the corresponding interface value does not
change.
we can easily reproduce this problem with the following commands:
cd /proc/sys/fs/epoll
echo -1 > max_user_watches; echo $?; cat max_user_watches
This function requires a non-negative number to be passed in, so when a
negative number is passed in, -EINVAL is returned.
Link: https://lkml.kernel.org/r/20211220092627.3744624-1-libaokun1@huawei.com
Signed-off-by: Baokun Li <libaokun1@huawei.com >
Reported-by: Hulk Robot <hulkci@huawei.com >
Acked-by: Luis Chamberlain <mcgrof@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:37 +02:00
Colin Ian King
e565a8ed1e
kernel/sysctl.c: remove unused variable ten_thousand
...
The const variable ten_thousand is not used, it is redundant and can be
removed.
Cleans up clang warning:
kernel/sysctl.c:99:18: warning: unused variable 'ten_thousand' [-Wunused-const-variable]
static const int ten_thousand = 10000;
Link: https://lkml.kernel.org/r/20211221184501.574670-1-colin.i.king@gmail.com
Fixes: c26da54dc8ca ("printk: move printk sysctl to printk/sysctl.c")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com >
Acked-by: Luis Chamberlain <mcgrof@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:37 +02:00
Xiaoming Ni
a737a3c674
kprobe: move sysctl_kprobes_optimization to kprobes.c
...
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
dishes, this makes it very difficult to maintain.
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
Move sysctl_kprobes_optimization from kernel/sysctl.c to
kernel/kprobes.c. Use register_sysctl() to register the sysctl
interface.
[mcgrof@kernel.org: fix compile issue when CONFIG_OPTPROBES is disabled]
Link: https://lkml.kernel.org/r/20211129211943.640266-7-mcgrof@kernel.org
Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Christian Brauner <christian.brauner@ubuntu.com >
Cc: "David S. Miller" <davem@davemloft.net >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com >
Cc: Stephen Kitt <steve@sk2.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Xiaoming Ni
f0bc21b268
fs/coredump: move coredump sysctls into its own file
...
This moves the fs/coredump.c respective sysctls to its own file.
Link: https://lkml.kernel.org/r/20211129211943.640266-6-mcgrof@kernel.org
Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Christian Brauner <christian.brauner@ubuntu.com >
Cc: "David S. Miller" <davem@davemloft.net >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com >
Cc: Stephen Kitt <steve@sk2.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Luis Chamberlain
d8c0418aac
kernel/sysctl.c: rename sysctl_init() to sysctl_init_bases()
...
Rename sysctl_init() to sysctl_init_bases() so to reflect exactly what
this is doing.
Link: https://lkml.kernel.org/r/20211129211943.640266-4-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Christian Brauner <christian.brauner@ubuntu.com >
Cc: "David S. Miller" <davem@davemloft.net >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Luis Chamberlain
ab171b952c
fs: move namespace sysctls and declare fs base directory
...
This moves the namespace sysctls to its own file as part of the
kernel/sysctl.c spring cleaning
Since we have now removed all sysctls for "fs", we now have to declare
it on the filesystem code, we do that using the new helper, which
reduces boiler plate code.
We rename init_fs_shared_sysctls() to init_fs_sysctls() to reflect that
now fs/sysctls.c is taking on the burden of being the first to register
the base directory as well.
Lastly, since init code will load in the order in which we link it we
have to move the sysctl code to be linked in early, so that its early
init routine runs prior to other fs code. This way, other filesystem
code can register their own sysctls using the helpers after this:
* register_sysctl_init()
* register_sysctl()
Link: https://lkml.kernel.org/r/20211129211943.640266-3-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Christian Brauner <christian.brauner@ubuntu.com >
Cc: "David S. Miller" <davem@davemloft.net >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Luis Chamberlain
51cb8dfc5a
sysctl: add and use base directory declarer and registration helper
...
Patch series "sysctl: add and use base directory declarer and
registration helper".
In this patch series we start addressing base directories, and so we
start with the "fs" sysctls. The end goal is we end up completely
moving all "fs" sysctl knobs out from kernel/sysctl.
This patch (of 6):
Add a set of helpers which can be used to declare and register base
directory sysctls on their own. We do this so we can later move each of
the base sysctl directories like "fs", "kernel", etc, to their own
respective files instead of shoving the declarations and registrations
all on kernel/sysctl.c. The lazy approach has caught up and with this,
we just end up extending the list of base directories / sysctls on one
file and this makes maintenance difficult due to merge conflicts from
many developers.
The declarations are used first by kernel/sysctl.c for registration its
own base which over time we'll try to clean up. It will be used in the
next patch to demonstrate how to cleanly deal with base sysctl
directories.
[mcgrof@kernel.org: null-terminate the ctl_table arrays]
Link: https://lkml.kernel.org/r/YafJY3rXDYnjK/gs@bombadil.infradead.org
Link: https://lkml.kernel.org/r/20211129211943.640266-1-mcgrof@kernel.org
Link: https://lkml.kernel.org/r/20211129211943.640266-2-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Kees Cook <keescook@chromium.org >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Christian Brauner <christian.brauner@ubuntu.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com >
Cc: "David S. Miller" <davem@davemloft.net >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Luis Chamberlain
1998f19324
fs: move pipe sysctls to is own file
...
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
dishes, this makes it very difficult to maintain.
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
So move the pipe sysctls to its own file.
Link: https://lkml.kernel.org/r/20211129205548.605569-10-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: "J. Bruce Fields" <bfields@fieldses.org >
Cc: Jeff Layton <jlayton@kernel.org >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Luis Chamberlain
66ad398634
fs: move fs/exec.c sysctls into its own file
...
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
dishes, this makes it very difficult to maintain.
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
So move the fs/exec.c respective sysctls to its own file.
Since checkpatch complains about style issues with the old code, this
move also fixes a few of those minor style issues:
* Use pr_warn() instead of prink(WARNING
* New empty lines are wanted at the beginning of routines
Link: https://lkml.kernel.org/r/20211129205548.605569-9-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: "J. Bruce Fields" <bfields@fieldses.org >
Cc: Jeff Layton <jlayton@kernel.org >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Luis Chamberlain
9c011be132
fs: move namei sysctls to its own file
...
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
dishes, this makes it very difficult to maintain.
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
So move namei's own sysctl knobs to its own file.
Other than the move we also avoid initializing two static variables to 0
as this is not needed:
* sysctl_protected_symlinks
* sysctl_protected_hardlinks
Link: https://lkml.kernel.org/r/20211129205548.605569-8-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: "J. Bruce Fields" <bfields@fieldses.org >
Cc: Jeff Layton <jlayton@kernel.org >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Luis Chamberlain
dd81faa883
fs: move locking sysctls where they are used
...
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
dishes, this makes it very difficult to maintain.
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
The locking fs sysctls are only used on fs/locks.c, so move them there.
Link: https://lkml.kernel.org/r/20211129205548.605569-7-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: "J. Bruce Fields" <bfields@fieldses.org >
Cc: Jeff Layton <jlayton@kernel.org >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Luis Chamberlain
d1d8ac9edf
fs: move shared sysctls to fs/sysctls.c
...
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
So move sysctls which are shared between filesystems into a common file
outside of kernel/sysctl.c.
Link: https://lkml.kernel.org/r/20211129205548.605569-6-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: "J. Bruce Fields" <bfields@fieldses.org >
Cc: Jeff Layton <jlayton@kernel.org >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Luis Chamberlain
54771613e8
sysctl: move maxolduid as a sysctl specific const
...
The maxolduid value is only shared for sysctl purposes for use on a max
range. Just stuff this into our shared const array.
[akpm@linux-foundation.org: fix sysctl_vals[], per Mickaël]
Link: https://lkml.kernel.org/r/20211129205548.605569-5-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Signed-off-by: Mickaël Salaün <mic@digikod.net >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: "J. Bruce Fields" <bfields@fieldses.org >
Cc: Jeff Layton <jlayton@kernel.org >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Luis Chamberlain
c8c0c239d5
fs: move dcache sysctls to its own file
...
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
dishes, this makes it very difficult to maintain.
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
So move the dcache sysctl clutter out of kernel/sysctl.c. This is a
small one-off entry, perhaps later we can simplify this representation,
but for now we use the helpers we have. We won't know how we can
simplify this further untl we're fully done with the cleanup.
[arnd@arndb.de: avoid unused-function warning]
Link: https://lkml.kernel.org/r/20211203190123.874239-2-arnd@kernel.org
Link: https://lkml.kernel.org/r/20211129205548.605569-4-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Signed-off-by: Arnd Bergmann <arnd@arndb.de >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: "J. Bruce Fields" <bfields@fieldses.org >
Cc: Jeff Layton <jlayton@kernel.org >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Luis Chamberlain
204d5a24e1
fs: move fs stat sysctls to file_table.c
...
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
dishes, this makes it very difficult to maintain.
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
We can create the sysctl dynamically on early init for fs stat to help
with this clutter. This dusts off the fs stat syctls knobs and puts
them into where they are declared.
Link: https://lkml.kernel.org/r/20211129205548.605569-3-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: "J. Bruce Fields" <bfields@fieldses.org >
Cc: Jeff Layton <jlayton@kernel.org >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:36 +02:00
Luis Chamberlain
1d67fe5850
fs: move inode sysctls to its own file
...
Patch series "sysctl: 4th set of kernel/sysctl cleanups".
This is slimming down the fs uses of kernel/sysctl.c to the point that
the next step is to just get rid of the fs base directory for it and
move that elsehwere, so that next patch series starts dealing with that
to demo how we can end up cleaning up a full base directory from
kernel/sysctl.c, one at a time.
This patch (of 9):
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
dishes, this makes it very difficult to maintain.
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
So move the inode sysctls to its own file. Since we are no longer using
this outside of fs/ remove the extern declaration of its respective proc
helper.
We use early_initcall() as it is the earliest we can use.
[arnd@arndb.de: avoid unused-variable warning]
Link: https://lkml.kernel.org/r/20211203190123.874239-1-arnd@kernel.org
Link: https://lkml.kernel.org/r/20211129205548.605569-1-mcgrof@kernel.org
Link: https://lkml.kernel.org/r/20211129205548.605569-2-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Signed-off-by: Arnd Bergmann <arnd@arndb.de >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Kees Cook <keescook@chromium.org >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Jeff Layton <jlayton@kernel.org >
Cc: "J. Bruce Fields" <bfields@fieldses.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:35 +02:00
Luis Chamberlain
b1f2aff888
sysctl: share unsigned long const values
...
Provide a way to share unsigned long values. This will allow others to
not have to re-invent these values.
Link: https://lkml.kernel.org/r/20211124231435.1445213-9-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Amir Goldstein <amir73il@gmail.com >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org >
Cc: Benjamin LaHaise <bcrl@kvack.org >
Cc: Clemens Ladisch <clemens@ladisch.de >
Cc: David Airlie <airlied@linux.ie >
Cc: Douglas Gilbert <dgilbert@interlog.com >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: James E.J. Bottomley <jejb@linux.ibm.com >
Cc: Jani Nikula <jani.nikula@intel.com >
Cc: Jani Nikula <jani.nikula@linux.intel.com >
Cc: Jan Kara <jack@suse.cz >
Cc: Joel Becker <jlbec@evilplan.org >
Cc: John Ogness <john.ogness@linutronix.de >
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Julia Lawall <julia.lawall@inria.fr >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Mark Fasheh <mark@fasheh.com >
Cc: Martin K. Petersen <martin.petersen@oracle.com >
Cc: Paul Turner <pjt@google.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Petr Mladek <pmladek@suse.com >
Cc: Phillip Potter <phil@philpotter.co.uk >
Cc: Qing Wang <wangqing@vivo.com >
Cc: "Rafael J. Wysocki" <rafael@kernel.org >
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com >
Cc: Sebastian Reichel <sre@kernel.org >
Cc: Sergey Senozhatsky <senozhatsky@chromium.org >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Steven Rostedt (VMware) <rostedt@goodmis.org >
Cc: Suren Baghdasaryan <surenb@google.com >
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp >
Cc: "Theodore Ts'o" <tytso@mit.edu >
Cc: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:35 +02:00
Xiaoming Ni
0df8bdd5e3
stackleak: move stack_erasing sysctl to stackleak.c
...
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
dishes, this makes it very difficult to maintain.
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
So move the stack_erasing sysctl from kernel/sysctl.c to
kernel/stackleak.c and use register_sysctl() to register the sysctl
interface.
[mcgrof@kernel.org: commit log update]
Link: https://lkml.kernel.org/r/20211124231435.1445213-8-mcgrof@kernel.org
Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Amir Goldstein <amir73il@gmail.com >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org >
Cc: Benjamin LaHaise <bcrl@kvack.org >
Cc: Clemens Ladisch <clemens@ladisch.de >
Cc: David Airlie <airlied@linux.ie >
Cc: Douglas Gilbert <dgilbert@interlog.com >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: James E.J. Bottomley <jejb@linux.ibm.com >
Cc: Jani Nikula <jani.nikula@intel.com >
Cc: Jani Nikula <jani.nikula@linux.intel.com >
Cc: Jan Kara <jack@suse.cz >
Cc: Joel Becker <jlbec@evilplan.org >
Cc: John Ogness <john.ogness@linutronix.de >
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Julia Lawall <julia.lawall@inria.fr >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Mark Fasheh <mark@fasheh.com >
Cc: Martin K. Petersen <martin.petersen@oracle.com >
Cc: Paul Turner <pjt@google.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Petr Mladek <pmladek@suse.com >
Cc: Phillip Potter <phil@philpotter.co.uk >
Cc: Qing Wang <wangqing@vivo.com >
Cc: "Rafael J. Wysocki" <rafael@kernel.org >
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com >
Cc: Sebastian Reichel <sre@kernel.org >
Cc: Sergey Senozhatsky <senozhatsky@chromium.org >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Steven Rostedt (VMware) <rostedt@goodmis.org >
Cc: Suren Baghdasaryan <surenb@google.com >
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp >
Cc: "Theodore Ts'o" <tytso@mit.edu >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:35 +02:00
Xiaoming Ni
26d1c80fd6
scsi/sg: move sg-big-buff sysctl to scsi/sg.c
...
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
dishes, this makes it very difficult to maintain.
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
So move the sg-big-buff sysctl from kernel/sysctl.c to drivers/scsi/sg.c
and use register_sysctl() to register the sysctl interface.
[mcgrof@kernel.org: commit log update]
Link: https://lkml.kernel.org/r/20211124231435.1445213-7-mcgrof@kernel.org
Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Amir Goldstein <amir73il@gmail.com >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org >
Cc: Benjamin LaHaise <bcrl@kvack.org >
Cc: Clemens Ladisch <clemens@ladisch.de >
Cc: David Airlie <airlied@linux.ie >
Cc: Douglas Gilbert <dgilbert@interlog.com >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: James E.J. Bottomley <jejb@linux.ibm.com >
Cc: Jani Nikula <jani.nikula@intel.com >
Cc: Jani Nikula <jani.nikula@linux.intel.com >
Cc: Jan Kara <jack@suse.cz >
Cc: Joel Becker <jlbec@evilplan.org >
Cc: John Ogness <john.ogness@linutronix.de >
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Julia Lawall <julia.lawall@inria.fr >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Mark Fasheh <mark@fasheh.com >
Cc: Martin K. Petersen <martin.petersen@oracle.com >
Cc: Paul Turner <pjt@google.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Petr Mladek <pmladek@suse.com >
Cc: Phillip Potter <phil@philpotter.co.uk >
Cc: Qing Wang <wangqing@vivo.com >
Cc: "Rafael J. Wysocki" <rafael@kernel.org >
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com >
Cc: Sebastian Reichel <sre@kernel.org >
Cc: Sergey Senozhatsky <senozhatsky@chromium.org >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Steven Rostedt (VMware) <rostedt@goodmis.org >
Cc: Suren Baghdasaryan <surenb@google.com >
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp >
Cc: "Theodore Ts'o" <tytso@mit.edu >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:35 +02:00
Xiaoming Ni
faaa357a55
printk: move printk sysctl to printk/sysctl.c
...
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
dishes, this makes it very difficult to maintain.
To help with this maintenance let's start by moving sysctls to places
where they actually belong. The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.
So move printk sysctl from kernel/sysctl.c to kernel/printk/sysctl.c.
Use register_sysctl() to register the sysctl interface.
[mcgrof@kernel.org: fixed compile issues when PRINTK is not set, commit log update]
Link: https://lkml.kernel.org/r/20211124231435.1445213-6-mcgrof@kernel.org
Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com >
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Amir Goldstein <amir73il@gmail.com >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Antti Palosaari <crope@iki.fi >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org >
Cc: Benjamin LaHaise <bcrl@kvack.org >
Cc: Clemens Ladisch <clemens@ladisch.de >
Cc: David Airlie <airlied@linux.ie >
Cc: Douglas Gilbert <dgilbert@interlog.com >
Cc: Eric Biederman <ebiederm@xmission.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Iurii Zaikin <yzaikin@google.com >
Cc: James E.J. Bottomley <jejb@linux.ibm.com >
Cc: Jani Nikula <jani.nikula@intel.com >
Cc: Jani Nikula <jani.nikula@linux.intel.com >
Cc: Jan Kara <jack@suse.cz >
Cc: Joel Becker <jlbec@evilplan.org >
Cc: John Ogness <john.ogness@linutronix.de >
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Julia Lawall <julia.lawall@inria.fr >
Cc: Kees Cook <keescook@chromium.org >
Cc: Lukas Middendorf <kernel@tuxforce.de >
Cc: Mark Fasheh <mark@fasheh.com >
Cc: Martin K. Petersen <martin.petersen@oracle.com >
Cc: Paul Turner <pjt@google.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Petr Mladek <pmladek@suse.com >
Cc: Phillip Potter <phil@philpotter.co.uk >
Cc: Qing Wang <wangqing@vivo.com >
Cc: "Rafael J. Wysocki" <rafael@kernel.org >
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com >
Cc: Sebastian Reichel <sre@kernel.org >
Cc: Sergey Senozhatsky <senozhatsky@chromium.org >
Cc: Stephen Kitt <steve@sk2.org >
Cc: Steven Rostedt (VMware) <rostedt@goodmis.org >
Cc: Suren Baghdasaryan <surenb@google.com >
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp >
Cc: "Theodore Ts'o" <tytso@mit.edu >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2022-01-22 08:33:35 +02:00