BACKPORT: locking: Add missing __sched attributes

This patch adds __sched attributes to a few missing places
to show blocked function rather than locking function
in get_wchan.

Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220115231657.84828-1-minchan@kernel.org

Conflicts:
	kernel/locking/percpu-rwsem.c

1. conflict <linux/sched/debug.h>

Bug: 228243692
Change-Id: Ifb50c13cfdd7484269d9a291a8da515e1cce6a7b
(cherry picked from commit c441e934b604a3b5f350a9104124cf6a3ba07a34)
Signed-off-by: Minchan Kim <minchan@google.com>
Signed-off-by: Richard Chang <richardycc@google.com>
(cherry picked from commit da358e264cbed0240debe37fa6867c81f0748bf8)
This commit is contained in:
Minchan Kim
2022-01-15 15:16:57 -08:00
committed by Richard Chang
parent f74aca771c
commit abafa1328b
2 changed files with 4 additions and 3 deletions

View File

@@ -8,6 +8,7 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/sched/task.h> #include <linux/sched/task.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/sched/debug.h>
#include <linux/errno.h> #include <linux/errno.h>
int __percpu_init_rwsem(struct percpu_rw_semaphore *sem, int __percpu_init_rwsem(struct percpu_rw_semaphore *sem,
@@ -163,7 +164,7 @@ static void percpu_rwsem_wait(struct percpu_rw_semaphore *sem, bool reader)
__set_current_state(TASK_RUNNING); __set_current_state(TASK_RUNNING);
} }
bool __percpu_down_read(struct percpu_rw_semaphore *sem, bool try) bool __sched __percpu_down_read(struct percpu_rw_semaphore *sem, bool try)
{ {
if (__percpu_down_read_trylock(sem)) if (__percpu_down_read_trylock(sem))
return true; return true;
@@ -212,7 +213,7 @@ static bool readers_active_check(struct percpu_rw_semaphore *sem)
return true; return true;
} }
void percpu_down_write(struct percpu_rw_semaphore *sem) void __sched percpu_down_write(struct percpu_rw_semaphore *sem)
{ {
might_sleep(); might_sleep();
rwsem_acquire(&sem->dep_map, 0, 0, _RET_IP_); rwsem_acquire(&sem->dep_map, 0, 0, _RET_IP_);

View File

@@ -1065,7 +1065,7 @@ out_nolock:
/* /*
* Wait until we successfully acquire the write lock * Wait until we successfully acquire the write lock
*/ */
static struct rw_semaphore * static struct rw_semaphore __sched *
rwsem_down_write_slowpath(struct rw_semaphore *sem, int state) rwsem_down_write_slowpath(struct rw_semaphore *sem, int state)
{ {
long count; long count;