Skip to content

Commit

Permalink
audit: we don't need to __set_current_state(TASK_RUNNING)
Browse files Browse the repository at this point in the history
Remove the calls to __set_current_state() to mark the task as running
and do some related cleanup in wait_for_auditd() to limit the amount
of work we do when we aren't going to reschedule the current task.

Signed-off-by: Paul Moore <paul@paul-moore.com>
  • Loading branch information
pcmoore committed Apr 4, 2016
1 parent 0bf676d commit 7ffb8e3
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions kernel/audit.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,6 @@ static void kauditd_send_skb(struct sk_buff *skb)
attempts, audit_pid);
set_current_state(TASK_INTERRUPTIBLE);
schedule();
__set_current_state(TASK_RUNNING);
goto restart;
}
}
Expand Down Expand Up @@ -1324,15 +1323,14 @@ static inline void audit_get_stamp(struct audit_context *ctx,
static long wait_for_auditd(long sleep_time)
{
DECLARE_WAITQUEUE(wait, current);
set_current_state(TASK_UNINTERRUPTIBLE);
add_wait_queue_exclusive(&audit_backlog_wait, &wait);

if (audit_backlog_limit &&
skb_queue_len(&audit_skb_queue) > audit_backlog_limit)
skb_queue_len(&audit_skb_queue) > audit_backlog_limit) {
add_wait_queue_exclusive(&audit_backlog_wait, &wait);
set_current_state(TASK_UNINTERRUPTIBLE);
sleep_time = schedule_timeout(sleep_time);

__set_current_state(TASK_RUNNING);
remove_wait_queue(&audit_backlog_wait, &wait);
remove_wait_queue(&audit_backlog_wait, &wait);
}

return sleep_time;
}
Expand Down

0 comments on commit 7ffb8e3

Please sign in to comment.