ipc,sem: use current->state helpers
PATCH 1/3 ipc,sem: use current->state helpers
Call __set_current_state() instead of assigning the new state directly. These interfaces also aid CONFIG_DEBUG_ATOMIC_SLEEP environments, keeping track of who changed the state.
--- ipc/sem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ipc/sem.c +1 -1
@@ -1941,7 +1941,7 @@ SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops, queue.sleeper = current; sleep_again: - current->state =TASK_INTERRUPTIBLE ; +__set_current_state (TASK_INTERRUPTIBLE );sem_unlock (sma, locknum);rcu_read_unlock ();
Signature · 1 line
2.1.2
PATCH 2/3 jbd: drop jbd_ENOSYS debug
A quick search shows that there are no users, drop the macro for both jbd and jbd2.
---
My goal here was to just change how we set current state, however I realized that the function is not used.
include/linux/jbd.h | 9 --------- include/linux/jbd2.h | 9 --------- 2 files changed, 18 deletions(-)
include/linux/jbd.h +0 -9
@@ -956,15 +956,6 @@ void __log_wait_for_space(journal_t *journal);extern void __journal_drop_transaction (journal_t *,transaction_t *);extern int cleanup_journal_tail (journal_t *); -/* Debugging code only: */ - -#define jbd_ENOSYS () \ -do { \ - printk (KERN_ERR "JBD unimplemented function %s\n", __func__); \ - current->state = TASK_UNINTERRUPTIBLE; \ - schedule(); \ -} while (1) -/* * is_journal_abort *
include/linux/jbd2.h +0 -9
@@ -1251,15 +1251,6 @@ void __jbd2_log_wait_for_space(journal_t *journal);extern void __jbd2_journal_drop_transaction (journal_t *,transaction_t *);extern int jbd2_cleanup_journal_tail (journal_t *); -/* Debugging code only: */ - -#define jbd_ENOSYS () \ -do { \ - printk (KERN_ERR "JBD unimplemented function %s\n", __func__); \ - current->state = TASK_UNINTERRUPTIBLE; \ - schedule(); \ -} while (1) -/* * is_journal_abort *
Signature · 1 line
2.1.2
Re: [PATCH 2/3] jbd: drop jbd_ENOSYS debug
Quoted 5 lines · Davidlohr Bueso
A quick search shows that there are no users, drop the macro for both jbd and jbd2.
Signed-off-by Davidlohr Bueso <[email protected]>Cc Jan Kara <[email protected]>
Thanks. I've added the patch to my tree.
Honza
Quoted 51 lines
---
My goal here was to just change how we set current state, however I realized that the function is not used.include/linux/jbd.h | 9 --------- include/linux/jbd2.h | 9 --------- 2 files changed, 18 deletions(-)include/linux/jbd.h +0
-9@@ -956,15 +956,6 @@ void __log_wait_for_space(journal_t *journal);extern void __journal_drop_transaction (journal_t *,transaction_t *);extern int cleanup_journal_tail (journal_t *); -/* Debugging code only: */ - -#define jbd_ENOSYS () \ -do { \ - printk (KERN_ERR "JBD unimplemented function %s\n", __func__); \ - current->state = TASK_UNINTERRUPTIBLE; \ - schedule(); \ -} while (1) -/* * is_journal_abort * include/linux/jbd2.h +0
-9@@ -1251,15 +1251,6 @@ void __jbd2_log_wait_for_space(journal_t *journal);extern void __jbd2_journal_drop_transaction (journal_t *,transaction_t *);extern int jbd2_cleanup_journal_tail (journal_t *); -/* Debugging code only: */ - -#define jbd_ENOSYS () \ -do { \ - printk (KERN_ERR "JBD unimplemented function %s\n", __func__); \ - current->state = TASK_UNINTERRUPTIBLE; \ - schedule(); \ -} while (1) -/* * is_journal_abort * Signature · 1 line
2.1.2
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
PATCH 3/3 signal: use current->state helpers
In reply to Davidlohr BuesoCall __set_current_state() instead of assigning the new state directly. These interfaces also aid CONFIG_DEBUG_ATOMIC_SLEEP environments, keeping track of who changed the state.
--- kernel/signal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/signal.c +2 -2
@@ -3550,7 +3550,7 @@ SYSCALL_DEFINE2(signal, int, sig, __sighandler_t, handler)SYSCALL_DEFINE0 (pause) {while (!signal_pending (current)) { - current->state =TASK_INTERRUPTIBLE ; +__set_current_state (TASK_INTERRUPTIBLE );schedule (); }return -ERESTARTNOHAND ;
@@ -3563,7 +3563,7 @@ int sigsuspend(sigset_t *set) current->saved_sigmask = current->blocked;set_current_blocked (set); - current->state =TASK_INTERRUPTIBLE ; +__set_current_state (TASK_INTERRUPTIBLE );schedule ();set_restore_sigmask ();return -ERESTARTNOHAND ;
Signature · 1 line
2.1.2
Re: [PATCH 3/3] signal: use current->state helpers
Quoted 4 lines · Davidlohr Bueso
Call
__set_current_state()instead of assigning the new state directly. These interfaces also aidCONFIG_DEBUG_ATOMIC_SLEEPenvironments, keeping track of who changed the state.
Quoted 31 lines
Signed-off-by Davidlohr Bueso <[email protected]>Cc Oleg Nesterov <[email protected]>--- kernel/signal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)kernel/signal.c +2
-2@@ -3550,7 +3550,7 @@ SYSCALL_DEFINE2(signal, int, sig, __sighandler_t, handler)SYSCALL_DEFINE0 (pause) {while (!signal_pending (current)) { - current->state =TASK_INTERRUPTIBLE ; +__set_current_state (TASK_INTERRUPTIBLE );schedule (); }return -ERESTARTNOHAND ;@@ -3563,7 +3563,7 @@ int sigsuspend(sigset_t *set) current->saved_sigmask = current->blocked;set_current_blocked (set); - current->state =TASK_INTERRUPTIBLE ; +__set_current_state (TASK_INTERRUPTIBLE );schedule ();set_restore_sigmask ();return -ERESTARTNOHAND ;Signature · 1 line
2.1.2