All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Two optimizations for libsepol
@ 2012-05-25 16:23 Adam Tkac
  0 siblings, 0 replies; only message in thread
From: Adam Tkac @ 2012-05-25 16:23 UTC (permalink / raw)
  To: selinux

[-- Attachment #1: Type: text/plain, Size: 1169 bytes --]

Hello all,

I've just finished two optimizations which speeds-up libsepol's
expand_filename_trans() function. Various se* commands (like setsebool,
semodule) now consumes only 15% of CPU time compared to current
expand_filename_trans() implementation.

The first patch is fairly simple and straightforward.

The second patch improves main expand_filename_trans() headache, comparsion of
two linked lists. It chunks the second list by filename_trans->stype value and
now algorithm walks only through piece of list where all elements have matching
filename_trans->stype value.

As an example, semodule run time is greatly decreased on my machine:

Original libsepol:
# time /usr/sbin/semodule -b /etc/selinux/targeted/modules/active/base.pp

real    1m54.548s
user    1m51.535s
sys     0m0.875s

After the first patch:
# time /usr/sbin/semodule -b /etc/selinux/targeted/modules/active/base.pp

real    1m43.243s
user    1m40.247s
sys     0m0.902s

Both patches applied:
# time /usr/sbin/semodule -b /etc/selinux/targeted/modules/active/base.pp

real    0m20.752s
user    0m18.508s
sys     0m0.984s

Any comments are welcomed.

Regards, Adam

-- 
Adam Tkac, Red Hat, Inc.

[-- Attachment #2: 0001-Optimize-expand_filename_trans-function-part1.patch --]
[-- Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-05-25 16:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-25 16:23 [PATCH] Two optimizations for libsepol Adam Tkac

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.