kernel/cgroup.c: make 2 functions static
PATCH 1/1 kernel/cgroup.c: make 2 functions static
cgroup_is_releasable() and notify_on_release() should be static, not global inline.
---
kernel/cgroup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
626d10ec224de07fc7906b0aa82e035e153709ce
kernel/cgroup.c +2 -2
@@ -143,7 +143,7 @@ enum { ROOT_NOPREFIX, /* mounted subsystems have no named prefix */ }; -inline int cgroup_is_releasable (const struct cgroup *cgrp) +static int cgroup_is_releasable (const struct cgroup *cgrp) {const int bits = (1 << CGRP_RELEASABLE) |
@@ -151,7 +151,7 @@ inline int cgroup_is_releasable(const struct cgroup *cgrp)return (cgrp->flags & bits) == bits; } -inline int notify_on_release (const struct cgroup *cgrp) +static int notify_on_release (const struct cgroup *cgrp) {return test_bit (CGRP_NOTIFY_ON_RELEASE , &cgrp->flags); }
Quoted 3 lines · Adrian Bunk
cgroup_is_releasable()andnotify_on_release()should be static, not global inline.
They seem like they could be usefully static inline - or will the compiler inline them anyway since they're simple enough?
Paul
Quoted 7 lines · Paul Menage
Quoted 3 lines · Adrian Bunk
cgroup_is_releasable()andnotify_on_release()should be static, not global inline.They seem like they could be usefully static inline - or will the compiler inline them anyway since they're simple enough?
gcc [1] will currently always inline a static cgroup_is_releasable() as long as it only has one caller.
Besides this, the compiler has the opportunity to inline all static functions when it thinks this makes sense, and it can base it's decision on things like whether we gave it -Os/-O2 and which CPU it's compiling for.
Long term manually forced "inline" has negative effects since functions tend to become larger and more often called without the "inline" removed, so don't use it unless there is a visible performance difference.
Quoted 1 line
Paul
cu
Adrian
[1] I'm talking about gcc 4
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon SeedQuoted 4 lines · Adrian Bunk
cgroup_is_releasable()andnotify_on_release()should be static, not global inline.Signed-off-by Adrian Bunk <[email protected]>
Quoted 31 lines
---
kernel/cgroup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
626d10ec224de07fc7906b0aa82e035e153709cekernel/cgroup.c +2
-2@@ -143,7 +143,7 @@ enum { ROOT_NOPREFIX, /* mounted subsystems have no named prefix */ }; -inline int cgroup_is_releasable (const struct cgroup *cgrp) +static int cgroup_is_releasable (const struct cgroup *cgrp) {const int bits = (1 << CGRP_RELEASABLE) |@@ -151,7 +151,7 @@ inline int cgroup_is_releasable(const struct cgroup *cgrp)return (cgrp->flags & bits) == bits; } -inline int notify_on_release (const struct cgroup *cgrp) +static int notify_on_release (const struct cgroup *cgrp) {return test_bit (CGRP_NOTIFY_ON_RELEASE , &cgrp->flags); }