public inbox for linux-audit@redhat.com
 help / color / mirror / Atom feed
From: Michael Neuling <mikey@neuling.org>
To: Eric Paris <eparis@redhat.com>
Cc: linux-audit@redhat.com, linux-kernel@vger.kernel.org,
	Al Viro <viro@zeniv.linux.org.uk>,
	anton@samba.org, sgrubb@redhat.com
Subject: Re: [PATCH] audit: speedup for syscalls when auditing is disabled
Date: Tue, 24 Aug 2010 15:56:07 +1000	[thread overview]
Message-ID: <5994.1282629367@neuling.org> (raw)
In-Reply-To: <1282621410.26616.406.camel@localhost.localdomain>

> > > I wonder if you could get much back, in terms of performance, by moving
> > > the
> > >          context->dummy = !audit_n_rules;
> > > line to the top and just returning if context->dummy == 1;
> > 
> > We get 668.09 cycles with this optimisation, so it comes down a bit, but
> > no where near if the auditing is disabled altogether.
> 
> Clean that patch up and send it.  Sounds like a win no matter what else
> we do.

ok...

audit: speedup audit_syscall_entry when there are zero rules

This creates a check at the start of audit_syscall_entry to see if there
are zero rules in the audit filter list.  If there are zero rules return
immediately.

This buys about ~10% on a null syscall on powerpc.

Signed-off-by: Michael Neuling <mikey@neuling.org>

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 1b31c13..bc0872b 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1579,6 +1579,9 @@ void audit_syscall_entry(int arch, int major,
 	if (unlikely(!context))
 		return;
 
+	context->dummy = !audit_n_rules;
+	if (context->dummy == 1)
+		return;
 	/*
 	 * This happens only on certain architectures that make system
 	 * calls in kernel_thread via the entry.S interface, instead of
@@ -1628,7 +1631,6 @@ void audit_syscall_entry(int arch, int major,
 	context->argv[3]    = a4;
 
 	state = context->state;
-	context->dummy = !audit_n_rules;
 	if (!context->dummy && state == AUDIT_BUILD_CONTEXT) {
 		context->prio = 0;
 		state = audit_filter_syscall(tsk, context, &audit_filter_list[AUDIT_FILTER_ENTRY]);

  reply	other threads:[~2010-08-24  5:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-20  2:13 [PATCH] audit: speedup for syscalls when auditing is disabled Michael Neuling
2010-08-23 17:56 ` Eric Paris
2010-08-24  2:11   ` Michael Neuling
2010-08-24  3:43     ` Eric Paris
2010-08-24  5:56       ` Michael Neuling [this message]
2010-08-24  5:56       ` Michael Neuling
2010-08-24 20:06         ` Eric Paris
2010-08-24 15:14       ` Miloslav Trmac
2010-08-24 15:17         ` Eric Paris
2010-08-25  3:11       ` Michael Neuling
2010-08-25 11:59         ` Eric Paris
2010-08-26  3:34           ` Anton Blanchard
2010-08-27 17:49             ` Eric Paris
2010-08-24  2:16   ` Anton Blanchard
2010-08-24  3:51     ` Eric Paris

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=5994.1282629367@neuling.org \
    --to=mikey@neuling.org \
    --cc=anton@samba.org \
    --cc=eparis@redhat.com \
    --cc=linux-audit@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sgrubb@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