mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	Guy Streeter <streeter@redhat.com>,
	Eric Paris <eparis@redhat.com>,
	David Woodhouse <dwmw2@infradead.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH -mm 1/1] audit: cleanup audit_log_start/wait_for_auditd mess
Date: Thu, 6 Jun 2013 13:55:55 -0700	[thread overview]
Message-ID: <20130606135555.15e649bccc02d8c738e71fa9@linux-foundation.org> (raw)
In-Reply-To: <20130603204620.GB21574@redhat.com>

On Mon, 3 Jun 2013 22:46:20 +0200 Oleg Nesterov <oleg@redhat.com> wrote:

> audit_log_start() tries to obfusticate the code/logic and
> reimplements wait_event_timeout() in a very confusing way.
> 
> Just change wait_for_auditd() to use wait_event_timeout()
> and return bool.
> 
> Also remove the unnecessary "ab = NULL" initialization.

I would prefer that this be nicely tested - for a cosmetic thing I
don't think it's worth the risk as-is.

> --- a/kernel/audit.c
> +++ b/kernel/audit.c
> @@ -1051,20 +1051,19 @@ static inline void audit_get_stamp(struct audit_context *ctx,
>  }
>  
>  /*
> - * Wait for auditd to drain the queue a little
> + * Wait for auditd to drain audit_skb_queue if it is full
>   */
> -static void wait_for_auditd(unsigned long sleep_time)
> +static bool wait_for_auditd(gfp_t gfp_mask)
>  {
> -	DECLARE_WAITQUEUE(wait, current);
> -	set_current_state(TASK_UNINTERRUPTIBLE);
> -	add_wait_queue(&audit_backlog_wait, &wait);
> -
> -	if (audit_backlog_limit &&
> -	    skb_queue_len(&audit_skb_queue) > audit_backlog_limit)
> -		schedule_timeout(sleep_time);
> -
> -	__set_current_state(TASK_RUNNING);
> -	remove_wait_queue(&audit_backlog_wait, &wait);
> +	/* Atomic callers use can 5 more entries over the limit */

"can use"

> +	if (!(gfp_mask & __GFP_WAIT))
> +		return skb_queue_len(&audit_skb_queue) <=
> +					audit_backlog_limit + 5;
> +
> +	return wait_event_timeout(audit_backlog_wait,
> +		!audit_backlog_limit ||
> +			skb_queue_len(&audit_skb_queue) <= audit_backlog_limit,
> +		audit_backlog_wait_time);
>  }
>
> ...
>

  reply	other threads:[~2013-06-06 20:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-03 20:45 [PATCH -mm 0/1] " Oleg Nesterov
2013-06-03 20:46 ` [PATCH -mm 1/1] " Oleg Nesterov
2013-06-06 20:55   ` Andrew Morton [this message]
2013-06-07 11:52     ` Oleg Nesterov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130606135555.15e649bccc02d8c738e71fa9@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=dwmw2@infradead.org \
    --cc=eparis@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=streeter@redhat.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®