Set the TASK_FREEZABLE flag when the kjournald2 kernel thread sleeps during journal commit operations. This prevents premature wakeups during system suspend/resume cycles, avoiding unnecessary CPU wakeups and power consumption. in this case, the original code: prepare_to_wait(&journal->j_wait_commit, &wait, TASK_INTERRUPTIBLE); if (journal->j_commit_sequence != journal->j_commit_request) should_sleep = 0; transaction = journal->j_running_transaction; if (transaction && time_after_eq(jiffies, transaction->t_expires)) should_sleep = 0; ...... ...... if (should_sleep) { write_unlock(&journal->j_state_lock); schedule(); write_lock(&journal->j_state_lock); } is functionally equivalent to the more concise: write_unlock(&journal->j_state_lock); wait_event_freezable_exclusive(&journal->j_wait_commit, journal->j_commit_sequence == journal->j_commit_request || (journal->j_running_transaction && time_after_eq(jiffies, transaction->t_expires)) || (journal->j_flags & JBD2_UNMOUNT)); write_lock(&journal->j_state_lock); Signed-off-by: Dai Junbing --- fs/jbd2/journal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index d480b94117cd..9a1def9f730b 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -222,7 +222,7 @@ static int kjournald2(void *arg) DEFINE_WAIT(wait); prepare_to_wait(&journal->j_wait_commit, &wait, - TASK_INTERRUPTIBLE); + TASK_INTERRUPTIBLE | TASK_FREEZABLE); transaction = journal->j_running_transaction; if (transaction == NULL || time_before(jiffies, transaction->t_expires)) { -- 2.25.1