Johannes Berg
7a1d55b987
gcov: combine common code
...
There's a lot of duplicated code between gcc and clang implementations,
move it over to fs.c to simplify the code, there's no reason to believe
that for small data like this one would not just implement the simple
convert_to_gcda() function.
Link: https://lkml.kernel.org/r/20210315235453.e3fbb86e99a0.I08a3ee6dbe47ea3e8024956083f162884a958e40@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com >
Acked-by: Peter Oberparleiter <oberpar@linux.ibm.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-07 00:26:32 -07:00
Pavel Tatashin
b2075dbb15
kexec: dump kmessage before machine_kexec
...
kmsg_dump(KMSG_DUMP_SHUTDOWN) is called before machine_restart(),
machine_halt(), and machine_power_off(). The only one that is missing
is machine_kexec().
The dmesg output that it contains can be used to study the shutdown
performance of both kernel and systemd during kexec reboot.
Here is example of dmesg data collected after kexec:
root@dplat-cp22:~# cat /sys/fs/pstore/dmesg-ramoops-0 | tail
...
[ 70.914592] psci: CPU3 killed (polled 0 ms)
[ 70.915705] CPU4: shutdown
[ 70.916643] psci: CPU4 killed (polled 4 ms)
[ 70.917715] CPU5: shutdown
[ 70.918725] psci: CPU5 killed (polled 0 ms)
[ 70.919704] CPU6: shutdown
[ 70.920726] psci: CPU6 killed (polled 4 ms)
[ 70.921642] CPU7: shutdown
[ 70.922650] psci: CPU7 killed (polled 0 ms)
Link: https://lkml.kernel.org/r/20210319192326.146000-2-pasha.tatashin@soleen.com
Signed-off-by: Pavel Tatashin <pasha.tatashin@soleen.com >
Reviewed-by: Kees Cook <keescook@chromium.org >
Reviewed-by: Petr Mladek <pmladek@suse.com >
Reviewed-by: Bhupesh Sharma <bhsharma@redhat.com >
Acked-by: Baoquan He <bhe@redhat.com >
Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com >
Cc: James Morris <jmorris@namei.org >
Cc: Sasha Levin <sashal@kernel.org >
Cc: Eric W. Biederman <ebiederm@xmission.com >
Cc: Anton Vorontsov <anton@enomsg.org >
Cc: Colin Cross <ccross@android.com >
Cc: Tony Luck <tony.luck@intel.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-07 00:26:32 -07:00
Jia-Ju Bai
31d82c2c78
kernel: kexec_file: fix error return code of kexec_calculate_store_digests()
...
When vzalloc() returns NULL to sha_regions, no error return code of
kexec_calculate_store_digests() is assigned. To fix this bug, ret is
assigned with -ENOMEM in this case.
Link: https://lkml.kernel.org/r/20210309083904.24321-1-baijiaju1990@gmail.com
Fixes: a43cac0d9d ("kexec: split kexec_file syscall code to kexec_file.c")
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com >
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn >
Acked-by: Baoquan He <bhe@redhat.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-07 00:26:32 -07:00
Joe LeVeque
a119b4e518
kexec: Add kexec reboot string
...
The purpose is to notify the kernel module for fast reboot.
Upstream a patch from the SONiC network operating system [1].
[1]: https://github.com/Azure/sonic-linux-kernel/pull/46
Link: https://lkml.kernel.org/r/20210304124626.13927-1-pmenzel@molgen.mpg.de
Signed-off-by: Joe LeVeque <jolevequ@microsoft.com >
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de >
Acked-by: Baoquan He <bhe@redhat.com >
Cc: Guohan Lu <lguohan@gmail.com >
Cc: Joe LeVeque <jolevequ@microsoft.com >
Cc: Paul Menzel <pmenzel@molgen.mpg.de >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-07 00:26:32 -07:00
Xiaofeng Cao
a8ca6b1388
kernel/fork.c: fix typos
...
change 'ancestoral' to 'ancestral'
change 'reuseable' to 'reusable'
delete 'do' grammatically
Link: https://lkml.kernel.org/r/20210317082031.11692-1-caoxiaofeng@yulong.com
Signed-off-by: Xiaofeng Cao <caoxiaofeng@yulong.com >
Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com >
Cc: Jens Axboe <axboe@kernel.dk >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:13 -07:00
Rolf Eike Beer
a689539938
kernel/fork.c: simplify copy_mm()
...
All this can happen without a single goto.
Link: https://lkml.kernel.org/r/2072685.XptgVkyDqn@devpool47
Signed-off-by: Rolf Eike Beer <eb@emlix.com >
Reviewed-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:13 -07:00
Jim Newsome
5449162ac0
do_wait: make PIDTYPE_PID case O(1) instead of O(n)
...
Add a special-case when waiting on a pid (via waitpid, waitid, wait4, etc)
to avoid doing an O(n) scan of children and tracees, and instead do an
O(1) lookup. This improves performance when waiting on a pid from a
thread group with many children and/or tracees.
Time to fork and then call waitpid on the child, from a task that already
has N children [1]:
N | Before | After
-----|---------|------
1 | 74 us | 74 us
20 | 72 us | 75 us
100 | 83 us | 77 us
500 | 99 us | 74 us
1000 | 179 us | 75 us
5000 | 804 us | 79 us
8000 | 1268 us | 78 us
[1]: https://lkml.org/lkml/2021/3/12/1567
This can make a substantial performance improvement for applications with
a thread that has many children or tracees and frequently needs to wait on
them. Tools that use ptrace to intercept syscalls for a large number of
processes are likely to fall into this category. In particular this patch
was developed while building a ptrace-based second generation of the
Shadow emulator [2], for which it allows us to avoid quadratic scaling
(without having to use a workaround that introduces a ~40% performance
penalty) [3]. Other examples of tools that fall into this category which
this patch may help include User Mode Linux [4] and DetTrace [5].
[2]: https://shadow.github.io/
[3]: https://github.com/shadow/shadow/issues/1134#issuecomment-798992292
[4]: https://en.wikipedia.org/wiki/User-mode_Linux
[5]: https://github.com/dettrace/dettrace
Link: https://lkml.kernel.org/r/20210314231544.9379-1-jnewsome@torproject.org
Signed-off-by: James Newsome <jnewsome@torproject.org >
Reviewed-by: Oleg Nesterov <oleg@redhat.com >
Cc: "Eric W . Biederman" <ebiederm@xmission.com >
Cc: Christian Brauner <christian@brauner.io >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:13 -07:00
Gustavo A. R. Silva
c1e4726f46
hpfs: replace one-element array with flexible-array member
...
There is a regular need in the kernel to provide a way to declare having
a dynamically sized set of trailing elements in a structure. Kernel code
should always use “flexible array members”[1] for these cases. The older
style of one-element or zero-length arrays should no longer be used[2].
Also, this helps with the ongoing efforts to enable -Warray-bounds by
fixing the following warning:
CC [M] fs/hpfs/dir.o
fs/hpfs/dir.c: In function `hpfs_readdir':
fs/hpfs/dir.c:163:41: warning: array subscript 1 is above array bounds of `u8[1]' {aka `unsigned char[1]'} [-Warray-bounds]
163 | || de ->name[0] != 1 || de->name[1] != 1))
| ~~~~~~~~^~~
[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.10/process/deprecated.html#zero-length-and-one-element-arrays
Link: https://github.com/KSPP/linux/issues/79
Link: https://github.com/KSPP/linux/issues/109
Link: https://lkml.kernel.org/r/20210326173510.GA81212@embeddedor
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org >
Cc: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:13 -07:00
Lu Jialin
312f79c486
nilfs2: fix typos in comments
...
numer -> number in fs/nilfs2/cpfile.c
Decription -> Description in fs/nilfs2/ioctl.c
isntance -> instance in fs/nilfs2/the_nilfs.c
Link: https://lkml.kernel.org/r/1617942951-14631-1-git-send-email-konishi.ryusuke@gmail.com
Link: https://lore.kernel.org/r/20210409022519.176988-1-lujialin4@huawei.com
Signed-off-by: Lu Jialin <lujialin4@huawei.com >
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:13 -07:00
Liu xuzhi
300563e6e0
fs/nilfs2: fix misspellings using codespell tool
...
Two typos are found out by codespell tool \
in 2217th and 2254th lines of segment.c:
$ codespell ./fs/nilfs2/
./segment.c:2217 :retured ==> returned
./segment.c:2254: retured ==> returned
Fix two typos found by codespell.
Link: https://lkml.kernel.org/r/1617864087-8198-1-git-send-email-konishi.ryusuke@gmail.com
Signed-off-by: Liu xuzhi <liu.xuzhi@zte.com.cn >
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:13 -07:00
Gustavo A. R. Silva
b4ca4c0178
isofs: fix fall-through warnings for Clang
...
In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
by explicitly adding a break statement instead of just letting the code
fall through to the next case.
Link: https://github.com/KSPP/linux/issues/115
Link: https://lkml.kernel.org/r/5b7caa73958588065fabc59032c340179b409ef5.1605896059.git.gustavoars@kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:13 -07:00
Davidlohr Bueso
7fab29e356
fs/epoll: restore waking from ep_done_scan()
...
Commit 339ddb53d3 ("fs/epoll: remove unnecessary wakeups of nested
epoll") changed the userspace visible behavior of exclusive waiters
blocked on a common epoll descriptor upon a single event becoming ready.
Previously, all tasks doing epoll_wait would awake, and now only one is
awoken, potentially causing missed wakeups on applications that rely on
this behavior, such as Apache Qpid.
While the aforementioned commit aims at having only a wakeup single path
in ep_poll_callback (with the exceptions of epoll_ctl cases), we need to
restore the wakeup in what was the old ep_scan_ready_list() such that
the next thread can be awoken, in a cascading style, after the waker's
corresponding ep_send_events().
Link: https://lkml.kernel.org/r/20210405231025.33829-3-dave@stgolabs.net
Fixes: 339ddb53d3 ("fs/epoll: remove unnecessary wakeups of nested epoll")
Signed-off-by: Davidlohr Bueso <dbueso@suse.de >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Jason Baron <jbaron@akamai.com >
Cc: Roman Penyaev <rpenyaev@suse.de >
Cc: <stable@vger.kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:13 -07:00
Davidlohr Bueso
1e3b918d1d
kselftest: introduce new epoll test case
...
Patch series "fs/epoll: restore user-visible behavior upon event ready".
This series tries to address a change in user visible behavior, reported
in https://bugzilla.kernel.org/show_bug.cgi?id=208943 .
Epoll does not report an event to all the threads running epoll_wait()
on the same epoll descriptor. Unsurprisingly, this was bisected back to
339ddb53d3 (fs/epoll: remove unnecessary wakeups of nested epoll), which
has had various problems in the past, beyond only nested epoll usage.
This patch (of 2):
This incorporates the testcase originally reported in:
https://bugzilla.kernel.org/show_bug.cgi?id=208943
Which ensures an event is reported to all threads blocked on the same
epoll descriptor, otherwise only a single thread will receive the wakeup
once the event become ready.
Link: https://lkml.kernel.org/r/20210405231025.33829-1-dave@stgolabs.net
Link: https://lkml.kernel.org/r/20210405231025.33829-2-dave@stgolabs.net
Signed-off-by: Davidlohr Bueso <dbueso@suse.de >
Cc: Jason Baron <jbaron@akamai.com >
Cc: Roman Penyaev <rpenyaev@suse.de >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:13 -07:00
Christophe JAILLET
7e6cdd7fd9
checkpatch: improve ALLOC_ARRAY_ARGS test
...
The devm_ variant of 'kcalloc()' and 'kmalloc_array()' are not tested
Add the corresponding check.
Link: https://lkml.kernel.org/r/205fc4847972fb6779abcc8818f39c14d1b45af1.1618595794.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr >
Acked-by: Joe Perches <joe@perches.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:13 -07:00
Vincent Mailhol
7b844345fc
checkpatch: exclude four preprocessor sub-expressions from MACRO_ARG_REUSE
...
__must_be_array, offsetof, sizeof_field and __stringify are all
preprocessor macros and do not evaluate their arguments. As such, it is
safe not to warn when arguments are being reused in those four
sub-expressions.
Exclude those so that they can pass checkpatch.
Link: https://lkml.kernel.org/r/20210407105042.25380-1-mailhol.vincent@wanadoo.fr
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr >
Acked-by: Joe Perches <joe@perches.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:13 -07:00
Joe Perches
fbe745416d
checkpatch: warn when missing newline in return sysfs_emit() formats
...
return sysfs_emit() uses should include a newline.
Suggest adding a newline when one is missing.
Add one using --fix too.
Link: https://lkml.kernel.org/r/aa1819fa5faf786573df298e5e2e7d357ba7d4ad.camel@perches.com
Signed-off-by: Joe Perches <joe@perches.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:12 -07:00
Masahiro Yamada
e13d04ec45
include/linux/compat.h: remove unneeded declaration from COMPAT_SYSCALL_DEFINEx()
...
compat_sys##name is declared twice, just one line below.
With this removal SYSCALL_DEFINEx() (defined in <linux/syscalls.h>)
and COMPAT_SYSCALL_DEFINEx() look symmetrical.
Link: https://lkml.kernel.org/r/20210223114924.854794-1-masahiroy@kernel.org
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:12 -07:00
Randy Dunlap
edd9334c8d
lib: parser: clean up kernel-doc
...
Mark match_uint() as kernel-doc notation since it is already fully
annotated as such. Use % prefix on constants in kernel-doc comments.
Convert function return descriptions to use the "Return:" kernel-doc
notation.
Link: https://lkml.kernel.org/r/20210407034514.5651-1-rdunlap@infradead.org
Signed-off-by: Randy Dunlap <rdunlap@infradead.org >
Cc: Alexander Viro <viro@zeniv.linux.org.uk >
Cc: David Howells <dhowells@redhat.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:12 -07:00
Alex Shi
9d6ecac093
lib/genalloc: add parameter description to fix doc compile warning
...
Commit 52fbf1134d ("lib/genalloc.c: fix allocation of aligned buffer
from non-aligned chunk") added a new parameter 'start_addr' w/o
description for it. That causes some doc compile warning:
lib/genalloc.c:649: warning: Function parameter or member 'start_addr' not described in 'gen_pool_first_fit'
lib/genalloc.c:667: warning: Function parameter or member 'start_addr' not described in 'gen_pool_first_fit_align'
lib/genalloc.c:694: warning: Function parameter or member 'start_addr' not described in 'gen_pool_fixed_alloc'
lib/genalloc.c:729: warning: Function parameter or member 'start_addr' not described in 'gen_pool_first_fit_order_align'
lib/genalloc.c:752: warning: Function parameter or member 'start_addr' not described in 'gen_pool_best_fit'
This fixes it by adding a parameter descriptions.
Link: https://lkml.kernel.org/r/20210405132021.131231-1-alexs@kernel.org
Signed-off-by: Alex Shi <alexs@kernel.org >
Cc: Alexey Skidanov <alexey.skidanov@intel.com >
Cc: Huang Shijie <sjhuang@iluvatar.ai >
Cc: Alex Shi <alexs@kernel.org >
Cc: Bhaskar Chowdhury <unixbhaskar@gmail.com >
Cc: Stephen Rothwell <sfr@canb.auug.org.au >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:12 -07:00
Alex Shi
db65a867fd
lib/percpu_counter: tame kernel-doc compile warning
...
commit 3e8f399da4 ("writeback: rework wb_[dec|inc]_stat family of
functions") add some function description of percpu_counter_add_batch.
but the double '*' in comments means a kernel-doc format comment which
isn't right.
Since the whole file of lib/percpu_counter.c has no any other kernel-doc
format comments, we'd better to remove this incomplete one to tame the
kernel-doc warning:
lib/percpu_counter.c:83: warning: Function parameter or member 'fbc' not described in 'percpu_counter_add_batch'
lib/percpu_counter.c:83: warning: Function parameter or member 'amount' not described in 'percpu_counter_add_batch'
lib/percpu_counter.c:83: warning: Function parameter or member 'batch' not described in 'percpu_counter_add_batch'
Link: https://lkml.kernel.org/r/20210405135505.132446-1-alexs@kernel.org
Signed-off-by: Alex Shi <alexs@kernel.org >
Cc: Nikolay Borisov <nborisov@suse.com >
Cc: Stephen Boyd <swboyd@chromium.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:12 -07:00
Zqiang
78564b9434
lib: stackdepot: turn depot_lock spinlock to raw_spinlock
...
In RT system, the spin_lock will be replaced by sleepable rt_mutex lock,
in __call_rcu(), disable interrupts before calling
kasan_record_aux_stack(), will trigger this calltrace:
BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:951
in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 19, name: pgdatinit0
Call Trace:
___might_sleep.cold+0x1b2/0x1f1
rt_spin_lock+0x3b/0xb0
stack_depot_save+0x1b9/0x440
kasan_save_stack+0x32/0x40
kasan_record_aux_stack+0xa5/0xb0
__call_rcu+0x117/0x880
__exit_signal+0xafb/0x1180
release_task+0x1d6/0x480
exit_notify+0x303/0x750
do_exit+0x678/0xcf0
kthread+0x364/0x4f0
ret_from_fork+0x22/0x30
Replace spinlock with raw_spinlock.
Link: https://lkml.kernel.org/r/20210329084009.27013-1-qiang.zhang@windriver.com
Signed-off-by: Zqiang <qiang.zhang@windriver.com >
Reported-by: Andrew Halaney <ahalaney@redhat.com >
Cc: Alexander Potapenko <glider@google.com >
Cc: Gustavo A. R. Silva <gustavoars@kernel.org >
Cc: Vijayanand Jitta <vjitta@codeaurora.org >
Cc: Vinayak Menon <vinmenon@codeaurora.org >
Cc: Yogesh Lal <ylal@codeaurora.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:12 -07:00
Richard Fitzgerald
e18baa7cc3
lib: crc8: pointer to data block should be const
...
crc8() does not change the data passed to it, so the pointer argument
should be declared const. This avoids callers that receive const data
having to cast it to a non-const pointer to call crc8().
Link: https://lkml.kernel.org/r/20210329122409.3291-1-rf@opensource.cirrus.com
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com >
Acked-by: Randy Dunlap <rdunlap@infradead.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:12 -07:00
Bhaskar Chowdhury
ade29d4fdb
lib/genalloc.c: Fix a typo
...
s/macthing/matching/
Link: https://lkml.kernel.org/r/20210326131530.30481-1-unixbhaskar@gmail.com
Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:12 -07:00
ToastC
e89b635805
lib/list_sort.c: fix typo in function description
...
Replace beautiully with beautifully
Link: https://lkml.kernel.org/r/20210315090633.9759-1-mrtoastcheng@gmail.com
Signed-off-by: ShihCheng Tu <mrtoastcheng@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:12 -07:00
Wang Qing
b8cf202779
lib: fix inconsistent indenting in process_bit1()
...
Smatch gives the warning:
lib/decompress_unlzma.c:395 process_bit1() warn: inconsistent indenting
Link: https://lkml.kernel.org/r/1614567775-4478-1-git-send-email-wangqing@vivo.com
Signed-off-by: Wang Qing <wangqing@vivo.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:12 -07:00
Bhaskar Chowdhury
0523c6922e
lib/bch.c: fix a typo in the file bch.c
...
s/buid/build/
Link: https://lkml.kernel.org/r/20210301123129.18754-1-unixbhaskar@gmail.com
Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com >
Acked-by: Randy Dunlap <rdunlap@infradead.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:12 -07:00
Yury Norov
550eb38bde
MAINTAINERS: add entry for the bitmap API
...
Add myself as maintainer for bitmap API and Andy and Rasmus as reviewers.
Link: https://lkml.kernel.org/r/20210401003153.97325-13-yury.norov@gmail.com
Signed-off-by: Yury Norov <yury.norov@gmail.com >
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Acked-by: Rasmus Villemoes <linux@rasmusvillemoes.dk >
Cc: Alexey Klimov <aklimov@redhat.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: David Sterba <dsterba@suse.com >
Cc: Dennis Zhou <dennis@kernel.org >
Cc: Geert Uytterhoeven <geert@linux-m68k.org >
Cc: Jianpeng Ma <jianpeng.ma@intel.com >
Cc: Joe Perches <joe@perches.com >
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Rich Felker <dalias@libc.org >
Cc: Stefano Brivio <sbrivio@redhat.com >
Cc: Wei Yang <richard.weiyang@linux.alibaba.com >
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com >
Cc: Yoshinori Sato <ysato@users.osdn.me >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:12 -07:00
Yury Norov
eaae7841ba
tools: sync lib/find_bit implementation
...
Add fast paths to find_*_bit() functions as per kernel implementation.
Link: https://lkml.kernel.org/r/20210401003153.97325-12-yury.norov@gmail.com
Signed-off-by: Yury Norov <yury.norov@gmail.com >
Acked-by: Rasmus Villemoes <linux@rasmusvillemoes.dk >
Cc: Alexey Klimov <aklimov@redhat.com >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: David Sterba <dsterba@suse.com >
Cc: Dennis Zhou <dennis@kernel.org >
Cc: Geert Uytterhoeven <geert@linux-m68k.org >
Cc: Jianpeng Ma <jianpeng.ma@intel.com >
Cc: Joe Perches <joe@perches.com >
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Rich Felker <dalias@libc.org >
Cc: Stefano Brivio <sbrivio@redhat.com >
Cc: Wei Yang <richard.weiyang@linux.alibaba.com >
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com >
Cc: Yoshinori Sato <ysato@users.osdn.me >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:12 -07:00
Yury Norov
2cc7b6a44a
lib: add fast path for find_first_*_bit() and find_last_bit()
...
Similarly to bitmap functions, users would benefit if we'll handle a case
of small-size bitmaps that fit into a single word.
While here, move the find_last_bit() declaration to bitops/find.h where
other find_*_bit() functions sit.
Link: https://lkml.kernel.org/r/20210401003153.97325-11-yury.norov@gmail.com
Signed-off-by: Yury Norov <yury.norov@gmail.com >
Acked-by: Rasmus Villemoes <linux@rasmusvillemoes.dk >
Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Cc: Alexey Klimov <aklimov@redhat.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: David Sterba <dsterba@suse.com >
Cc: Dennis Zhou <dennis@kernel.org >
Cc: Geert Uytterhoeven <geert@linux-m68k.org >
Cc: Jianpeng Ma <jianpeng.ma@intel.com >
Cc: Joe Perches <joe@perches.com >
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Rich Felker <dalias@libc.org >
Cc: Stefano Brivio <sbrivio@redhat.com >
Cc: Wei Yang <richard.weiyang@linux.alibaba.com >
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com >
Cc: Yoshinori Sato <ysato@users.osdn.me >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:12 -07:00
Yury Norov
277a20a498
lib: add fast path for find_next_*_bit()
...
Similarly to bitmap functions, find_next_*_bit() users will benefit if
we'll handle a case of bitmaps that fit into a single word inline. In the
very best case, the compiler may replace a function call with a few
instructions.
This is the quite typical find_next_bit() user:
unsigned int cpumask_next(int n, const struct cpumask *srcp)
{
/* -1 is a legal arg here. */
if (n != -1)
cpumask_check(n);
return find_next_bit(cpumask_bits(srcp), nr_cpumask_bits, n + 1);
}
EXPORT_SYMBOL(cpumask_next);
Currently, on ARM64 the generated code looks like this:
0000000000000000 <cpumask_next>:
0: a9bf7bfd stp x29, x30, [sp, #-16]!
4: 11000402 add w2, w0, #0x1
8: aa0103e0 mov x0, x1
c: d2800401 mov x1, #0x40 // #64
10: 910003fd mov x29, sp
14: 93407c42 sxtw x2, w2
18: 94000000 bl 0 <find_next_bit>
1c: a8c17bfd ldp x29, x30, [sp], #16
20: d65f03c0 ret
24: d503201f nop
After applying this patch:
0000000000000140 <cpumask_next>:
140: 11000400 add w0, w0, #0x1
144: 93407c00 sxtw x0, w0
148: f100fc1f cmp x0, #0x3f
14c: 54000168 b.hi 178 <cpumask_next+0x38> // b.pmore
150: f9400023 ldr x3, [x1]
154: 92800001 mov x1, #0xffffffffffffffff // #-1
158: 9ac02020 lsl x0, x1, x0
15c: 52800802 mov w2, #0x40 // #64
160: 8a030001 and x1, x0, x3
164: dac00020 rbit x0, x1
168: f100003f cmp x1, #0x0
16c: dac01000 clz x0, x0
170: 1a800040 csel w0, w2, w0, eq // eq = none
174: d65f03c0 ret
178: 52800800 mov w0, #0x40 // #64
17c: d65f03c0 ret
find_next_bit() call is replaced with 6 instructions. find_next_bit()
itself is 41 instructions plus function call overhead.
Despite inlining, the scripts/bloat-o-meter report smaller .text size
after applying the series:
add/remove: 11/9 grow/shrink: 233/176 up/down: 5780/-6768 (-988)
Link: https://lkml.kernel.org/r/20210401003153.97325-10-yury.norov@gmail.com
Signed-off-by: Yury Norov <yury.norov@gmail.com >
Acked-by: Rasmus Villemoes <linux@rasmusvillemoes.dk >
Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Cc: Alexey Klimov <aklimov@redhat.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: David Sterba <dsterba@suse.com >
Cc: Dennis Zhou <dennis@kernel.org >
Cc: Geert Uytterhoeven <geert@linux-m68k.org >
Cc: Jianpeng Ma <jianpeng.ma@intel.com >
Cc: Joe Perches <joe@perches.com >
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Rich Felker <dalias@libc.org >
Cc: Stefano Brivio <sbrivio@redhat.com >
Cc: Wei Yang <richard.weiyang@linux.alibaba.com >
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com >
Cc: Yoshinori Sato <ysato@users.osdn.me >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:12 -07:00
Yury Norov
ea81c1ef44
tools: sync find_next_bit implementation
...
Sync the implementation with recent kernel changes.
Link: https://lkml.kernel.org/r/20210401003153.97325-9-yury.norov@gmail.com
Signed-off-by: Yury Norov <yury.norov@gmail.com >
Acked-by: Rasmus Villemoes <linux@rasmusvillemoes.dk >
Cc: Alexey Klimov <aklimov@redhat.com >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: David Sterba <dsterba@suse.com >
Cc: Dennis Zhou <dennis@kernel.org >
Cc: Geert Uytterhoeven <geert@linux-m68k.org >
Cc: Jianpeng Ma <jianpeng.ma@intel.com >
Cc: Joe Perches <joe@perches.com >
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Rich Felker <dalias@libc.org >
Cc: Stefano Brivio <sbrivio@redhat.com >
Cc: Wei Yang <richard.weiyang@linux.alibaba.com >
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com >
Cc: Yoshinori Sato <ysato@users.osdn.me >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:12 -07:00
Yury Norov
5c88af59f9
lib: inline _find_next_bit() wrappers
...
lib/find_bit.c declares five single-line wrappers for _find_next_bit().
We may turn those wrappers to inline functions. It eliminates unneeded
function calls and opens room for compile-time optimizations.
Link: https://lkml.kernel.org/r/20210401003153.97325-8-yury.norov@gmail.com
Signed-off-by: Yury Norov <yury.norov@gmail.com >
Acked-by: Rasmus Villemoes <linux@rasmusvillemoes.dk >
Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Cc: Alexey Klimov <aklimov@redhat.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: David Sterba <dsterba@suse.com >
Cc: Dennis Zhou <dennis@kernel.org >
Cc: Geert Uytterhoeven <geert@linux-m68k.org >
Cc: Jianpeng Ma <jianpeng.ma@intel.com >
Cc: Joe Perches <joe@perches.com >
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Rich Felker <dalias@libc.org >
Cc: Stefano Brivio <sbrivio@redhat.com >
Cc: Wei Yang <richard.weiyang@linux.alibaba.com >
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com >
Cc: Yoshinori Sato <ysato@users.osdn.me >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:12 -07:00
Yury Norov
78e48f0667
tools: sync small_const_nbits() macro with the kernel
...
Sync implementation with the kernel and move the macro from
tools/include/linux/bitmap.h to tools/include/asm-generic/bitsperlong.h
Link: https://lkml.kernel.org/r/20210401003153.97325-7-yury.norov@gmail.com
Signed-off-by: Yury Norov <yury.norov@gmail.com >
Acked-by: Rasmus Villemoes <linux@rasmusvillemoes.dk >
Cc: Alexey Klimov <aklimov@redhat.com >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: David Sterba <dsterba@suse.com >
Cc: Dennis Zhou <dennis@kernel.org >
Cc: Geert Uytterhoeven <geert@linux-m68k.org >
Cc: Jianpeng Ma <jianpeng.ma@intel.com >
Cc: Joe Perches <joe@perches.com >
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Rich Felker <dalias@libc.org >
Cc: Stefano Brivio <sbrivio@redhat.com >
Cc: Wei Yang <richard.weiyang@linux.alibaba.com >
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com >
Cc: Yoshinori Sato <ysato@users.osdn.me >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:12 -07:00
Yury Norov
586eaebea5
lib: extend the scope of small_const_nbits() macro
...
find_bit would also benefit from small_const_nbits() optimizations. The
detailed comment is provided by Rasmus Villemoes.
Link: https://lkml.kernel.org/r/20210401003153.97325-6-yury.norov@gmail.com
Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk >
Signed-off-by: Yury Norov <yury.norov@gmail.com >
Acked-by: Rasmus Villemoes <linux@rasmusvillemoes.dk >
Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Cc: Alexey Klimov <aklimov@redhat.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: David Sterba <dsterba@suse.com >
Cc: Dennis Zhou <dennis@kernel.org >
Cc: Geert Uytterhoeven <geert@linux-m68k.org >
Cc: Jianpeng Ma <jianpeng.ma@intel.com >
Cc: Joe Perches <joe@perches.com >
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Rich Felker <dalias@libc.org >
Cc: Stefano Brivio <sbrivio@redhat.com >
Cc: Wei Yang <richard.weiyang@linux.alibaba.com >
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com >
Cc: Yoshinori Sato <ysato@users.osdn.me >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:11 -07:00
Yury Norov
bb8bc36ef8
arch: rearrange headers inclusion order in asm/bitops for m68k, sh and h8300
...
m68k and sh include bitmap/{find,le}.h prior to ffs/fls headers. New
fast-path implementation in find.h requires ffs/fls. Reordering the
headers inclusion sequence helps to prevent compile-time implicit function
declaration error.
[yury.norov@gmail.com: h8300: rearrange headers inclusion order in asm/bitops]
Link: https://lkml.kernel.org/r/20210406183625.794227-1-yury.norov@gmail.com
Link: https://lkml.kernel.org/r/20210401003153.97325-5-yury.norov@gmail.com
Signed-off-by: Yury Norov <yury.norov@gmail.com >
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org >
Acked-by: Rasmus Villemoes <linux@rasmusvillemoes.dk >
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Tested-by: Guenter Roeck <linux@roeck-us.net >
Cc: Alexey Klimov <aklimov@redhat.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: David Sterba <dsterba@suse.com >
Cc: Dennis Zhou <dennis@kernel.org >
Cc: Jianpeng Ma <jianpeng.ma@intel.com >
Cc: Joe Perches <joe@perches.com >
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Rich Felker <dalias@libc.org >
Cc: Stefano Brivio <sbrivio@redhat.com >
Cc: Wei Yang <richard.weiyang@linux.alibaba.com >
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com >
Cc: Yoshinori Sato <ysato@users.osdn.me >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:11 -07:00
Yury Norov
a719101f19
tools: sync BITMAP_LAST_WORD_MASK() macro with the kernel
...
Kernel version generates better code.
Link: https://lkml.kernel.org/r/20210401003153.97325-4-yury.norov@gmail.com
Signed-off-by: Yury Norov <yury.norov@gmail.com >
Acked-by: Rasmus Villemoes <linux@rasmusvillemoes.dk >
Cc: Alexey Klimov <aklimov@redhat.com >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: David Sterba <dsterba@suse.com >
Cc: Dennis Zhou <dennis@kernel.org >
Cc: Geert Uytterhoeven <geert@linux-m68k.org >
Cc: Jianpeng Ma <jianpeng.ma@intel.com >
Cc: Joe Perches <joe@perches.com >
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Rich Felker <dalias@libc.org >
Cc: Stefano Brivio <sbrivio@redhat.com >
Cc: Wei Yang <richard.weiyang@linux.alibaba.com >
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com >
Cc: Yoshinori Sato <ysato@users.osdn.me >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:11 -07:00
Yury Norov
e5b9252d90
tools: bitmap: sync function declarations with the kernel
...
Some functions in tools/include/linux/bitmap.h declare nbits as int. In
the kernel nbits is declared as unsigned int.
Link: https://lkml.kernel.org/r/20210401003153.97325-3-yury.norov@gmail.com
Signed-off-by: Yury Norov <yury.norov@gmail.com >
Acked-by: Rasmus Villemoes <linux@rasmusvillemoes.dk >
Cc: Alexey Klimov <aklimov@redhat.com >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: David Sterba <dsterba@suse.com >
Cc: Dennis Zhou <dennis@kernel.org >
Cc: Geert Uytterhoeven <geert@linux-m68k.org >
Cc: Jianpeng Ma <jianpeng.ma@intel.com >
Cc: Joe Perches <joe@perches.com >
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Rich Felker <dalias@libc.org >
Cc: Stefano Brivio <sbrivio@redhat.com >
Cc: Wei Yang <richard.weiyang@linux.alibaba.com >
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com >
Cc: Yoshinori Sato <ysato@users.osdn.me >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:11 -07:00
Yury Norov
d1d1a2cd46
tools: disable -Wno-type-limits
...
Patch series "lib/find_bit: fast path for small bitmaps", v6.
Bitmap operations are much simpler and faster in case of small bitmaps
which fit into a single word. In linux/bitmap.c we have a machinery that
allows compiler to replace actual function call with a few instructions if
bitmaps passed into the function are small and their size is known at
compile time.
find_*_bit() API lacks this functionality; but users will benefit from it
a lot. One important example is cpumask subsystem when NR_CPUS <=
BITS_PER_LONG.
This patch (of 12):
GENMASK(h, l) may be passed with unsigned types. In such case,
type-limits warning is generated for example in case of GENMASK(h, 0).
Link: https://lkml.kernel.org/r/20210401003153.97325-1-yury.norov@gmail.com
Link: https://lkml.kernel.org/r/20210401003153.97325-2-yury.norov@gmail.com
Signed-off-by: Yury Norov <yury.norov@gmail.com >
Acked-by: Rasmus Villemoes <linux@rasmusvillemoes.dk >
Cc: Alexey Klimov <aklimov@redhat.com >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: David Sterba <dsterba@suse.com >
Cc: Dennis Zhou <dennis@kernel.org >
Cc: Geert Uytterhoeven <geert@linux-m68k.org >
Cc: Jianpeng Ma <jianpeng.ma@intel.com >
Cc: Joe Perches <joe@perches.com >
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de >
Cc: Josh Poimboeuf <jpoimboe@redhat.com >
Cc: Rich Felker <dalias@libc.org >
Cc: Stefano Brivio <sbrivio@redhat.com >
Cc: Wei Yang <richard.weiyang@linux.alibaba.com >
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com >
Cc: Yoshinori Sato <ysato@users.osdn.me >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:11 -07:00
Rasmus Villemoes
32c93976ac
kernel/cred.c: make init_groups static
...
init_groups is declared in both cred.h and init_task.h, but it is not
actually referenced anywhere outside of cred.c where it is defined. So
make it static and remove the declarations.
Link: https://lkml.kernel.org/r/20210310220102.2484201-1-linux@rasmusvillemoes.dk
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:11 -07:00
Rasmus Villemoes
8ba9d40b6b
kernel/async.c: fix pr_debug statement
...
An async_func_t returns void - any errors encountered it has to stash
somewhere for consumers to discover later.
Link: https://lkml.kernel.org/r/20210226124355.2503524-1-linux@rasmusvillemoes.dk
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk >
Cc: Tejun Heo <tj@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:11 -07:00
Wan Jiabing
112dfce8f2
linux/profile.h: remove unnecessary declaration
...
Declaring struct pt_regs is unnecessary. On the one hand, there is no
function using it; on the other hand, struct pt_regs has been declared in
linux/kernel.h. Remove them.
Link: https://lkml.kernel.org/r/20210401104834.1009157-1-wanjiabing@vivo.com
Signed-off-by: Wan Jiabing <wanjiabing@vivo.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:11 -07:00
Andy Shevchenko
08c5188ef4
kernel.h: drop inclusion in bitmap.h
...
The bitmap.h header is used in a lot of code around the kernel. Besides
that it includes kernel.h which sometimes makes a loop.
The problem here is many unneeded loops that make header hell
dependencies. For example, how may you move bitmap_zalloc() from C-file
to the header? Currently it's impossible. And bitmap.h here is only the
tip of an iceberg.
kerne.h is a dump of everything that even has nothing in common at all.
We may still have it, but in my new code I prefer to include only the
headers that I want to use, without the bulk of unneeded kernel code.
Break the loop by introducing align.h, including it in kernel.h and
bitmap.h followed by replacing kernel.h with limits.h.
Link: https://lkml.kernel.org/r/20210326170347.37441-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Acked-by: Yury Norov <yury.norov@gmail.com >
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:11 -07:00
Matthew Wilcox (Oracle)
4ee60ec156
include: remove pagemap.h from blkdev.h
...
My UEK-derived config has 1030 files depending on pagemap.h before this
change. Afterwards, just 326 files need to be rebuilt when I touch
pagemap.h. I think blkdev.h is probably included too widely, but
untangling that dependency is harder and this solves my problem. x86
allmodconfig builds, but there may be implicit include problems on other
architectures.
Link: https://lkml.kernel.org/r/20210309195747.283796-1-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Acked-by: Dan Williams <dan.j.williams@intel.com > [nvdimm]
Acked-by: Jens Axboe <axboe@kernel.dk > [block]
Reviewed-by: Christoph Hellwig <hch@lst.de >
Acked-by: Coly Li <colyli@suse.de > [bcache]
Acked-by: Martin K. Petersen <martin.petersen@oracle.com > [scsi]
Reviewed-by: William Kucharski <william.kucharski@oracle.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:11 -07:00
zhouchuangao
5b31a7dfa3
proc/sysctl: fix function name error in comments
...
The function name should be modified to register_sysctl_paths instead of
register_sysctl_table_path.
Link: https://lkml.kernel.org/r/1615807194-79646-1-git-send-email-zhouchuangao@vivo.com
Signed-off-by: zhouchuangao <zhouchuangao@vivo.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:11 -07:00
Alexey Dobriyan
268af17ada
selftests: proc: test subset=pid
...
Test that /proc instance mounted with
mount -t proc -o subset=pid
contains only ".", "..", "self", "thread-self" and pid directories.
Note:
Currently "subset=pid" doesn't return "." and ".." via readdir.
This must be a bug.
Link: https://lkml.kernel.org/r/YFYZZ7WGaZlsnChS@localhost.localdomain
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com >
Acked-by: Alexey Gladkov <gladkov.alexey@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:11 -07:00
Alexey Dobriyan
1dcdd7ef96
proc: delete redundant subset=pid check
...
Two checks in lookup and readdir code should be enough to not have third
check in open code.
Can't open what can't be looked up?
Link: https://lkml.kernel.org/r/YFYYwIBIkytqnkxP@localhost.localdomain
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com >
Acked-by: Alexey Gladkov <gladkov.alexey@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:11 -07:00
Alexey Dobriyan
d4455faccd
proc: mandate ->proc_lseek in "struct proc_ops"
...
Now that proc_ops are separate from file_operations and other operations
it easy to check all instances to have ->proc_lseek hook and remove check
in main code.
Note:
nonseekable_open() files naturally don't require ->proc_lseek.
Garbage collect pde_lseek() function.
[adobriyan@gmail.com: smoke test lseek()]
Link: https://lkml.kernel.org/r/YG4OIhChOrVTPgdN@localhost.localdomain
Link: https://lkml.kernel.org/r/YFYX0Bzwxlc7aBa/@localhost.localdomain
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:11 -07:00
Alexey Dobriyan
b793cd9ab3
proc: save LOC in __xlate_proc_name()
...
Can't look at this verbosity anymore.
Link: https://lkml.kernel.org/r/YFYXAp/fgq405qcy@localhost.localdomain
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:11 -07:00
Colin Ian King
f4bf74d829
fs/proc/generic.c: fix incorrect pde_is_permanent check
...
Currently the pde_is_permanent() check is being run on root multiple times
rather than on the next proc directory entry. This looks like a
copy-paste error. Fix this by replacing root with next.
Addresses-Coverity: ("Copy-paste error")
Link: https://lkml.kernel.org/r/20210318122633.14222-1-colin.king@canonical.com
Fixes: d919b33daf ("proc: faster open/read/close with "permanent" files")
Signed-off-by: Colin Ian King <colin.king@canonical.com >
Acked-by: Christian Brauner <christian.brauner@ubuntu.com >
Reviewed-by: Alexey Dobriyan <adobriyan@gmail.com >
Cc: Greg Kroah-Hartman <gregkh@google.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:11 -07:00
Randy Dunlap
0214967a37
alpha: csum_partial_copy.c: add function prototypes from <net/checksum.h>
...
Fix "no previous prototype" W=1 warnings from the kernel test robot:
arch/alpha/lib/csum_partial_copy.c:349:1: error: no previous prototype for 'csum_and_copy_from_user' [-Werror=missing-prototypes]
349 | csum_and_copy_from_user(const void __user *src, void *dst, int len)
| ^~~~~~~~~~~~~~~~~~~~~~~
arch/alpha/lib/csum_partial_copy.c:358:1: error: no previous prototype for 'csum_partial_copy_nocheck' [-Werror=missing-prototypes]
358 | csum_partial_copy_nocheck(const void *src, void *dst, int len)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
Link: https://lkml.kernel.org/r/20210425235749.19113-1-rdunlap@infradead.org
Fixes: 808b49da54 ("alpha: turn csum_partial_copy_from_user() into csum_and_copy_from_user()")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org >
Reported-by: kernel test robot <lkp@intel.com >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Richard Henderson <rth@twiddle.net >
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru >
Cc: Matt Turner <mattst88@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-05-06 19:24:11 -07:00