Re: Inapropriate inlining in ci/include/cluster/synch.h
John Hughes <[email protected]>
| Newsgroups | gmane.linux.cluster.ssic.devel |
|---|---|
| Message-ID | <[email protected]> |
John Hughes wrote:
> We have:
>
> static inline void _ssi_wait_event(EVENT_T *eventp, int intr, int *was_intrp)
> {
> EVENT_WAIT_T evwait;
> sigset_t old_blocked;
> task_t *tsk = current;
> unsigned long flags;
> int interrupted = 0;
>
> That's rather a lot to inline. The 3 calls in icssvr_daemon take up
> around 84 bytes of stack.
>
A patch.
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
ssic-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ssic-linux-devel
synch-stack-usage.patch
(text/x-patch, 5.2 KB)
Index: kernel/cluster/util/Makefile
===================================================================
RCS file: /usr/local/lib/cvs-repo/sourceforge-ci/kernel/cluster/util/Makefile,v
retrieving revision 1.4
retrieving revision 1.4.6.1
diff -u -r1.4 -r1.4.6.1
--- kernel/cluster/util/Makefile 27 Oct 2004 09:40:16 -0000 1.4
+++ kernel/cluster/util/Makefile 16 Jan 2009 21:00:59 -0000 1.4.6.1
@@ -8,4 +8,5 @@
obj-$(CONFIG_CLUSTER) := assert.o cluster_ksyms.o cluster_api_ics.o nsc_async.o nsc_daemon.o
obj-$(CONFIG_CLUSTER) += nsc_ics.o nsc_init.o nsc_log.o nsc_nodelist.o nsc_scalls.o nsc_xdr.o
obj-$(CONFIG_CLUSTER) += nsc_callback.o nsc_ndreg.o xdr_msghdr.o xdr.o assert.o node_monitor.o
+obj-$(CONFIG_CLUSTER) += synch.o
Index: kernel/cluster/util/synch.c
===================================================================
RCS file: kernel/cluster/util/synch.c
diff -N kernel/cluster/util/synch.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ kernel/cluster/util/synch.c 16 Jan 2009 21:00:59 -0000 1.1.2.1
@@ -0,0 +1,2 @@
+#define _CLUSTER_OUTLINE
+#include <cluster/synch.h>
Index: kernel/include/cluster/synch.h
===================================================================
RCS file: /usr/local/lib/cvs-repo/sourceforge-ci/kernel/include/cluster/synch.h,v
retrieving revision 1.15.2.7
retrieving revision 1.15.2.7.2.1
diff -u -r1.15.2.7 -r1.15.2.7.2.1
--- kernel/include/cluster/synch.h 7 Jan 2009 14:18:20 -0000 1.15.2.7
+++ kernel/include/cluster/synch.h 16 Jan 2009 21:00:59 -0000 1.15.2.7.2.1
@@ -264,31 +264,27 @@
static inline int _ssi_try_lock_spin_lock(SPIN_LOCK_T *lockp _SSI_LOCK_WHERE)
{
- int locked;
-
_SSI_LOCK_ASSERT_INITED(lockp);
_SSI_LOCK_ASSERT(lockp->sp_owner != current);
_SSI_LOCK_ASSERT(!in_interrupt());
- locked = spin_trylock(&lockp->sp_lock);
- if (locked)
+ if (spin_trylock(&lockp->sp_lock)) {
lockp->sp_owner = current;
-
- return locked;
+ return 1;
+ }
+ return 0;
}
static inline int _ssi_atomic_dec_and_lock_spin_lock(
atomic_t *atomic, SPIN_LOCK_T *lockp _SSI_LOCK_WHERE)
{
- int locked;
-
_SSI_LOCK_ASSERT_INITED(lockp);
_SSI_LOCK_ASSERT(lockp->sp_owner != current);
_SSI_LOCK_ASSERT(!in_interrupt());
- locked = atomic_dec_and_lock(atomic, &lockp->sp_lock);
- if (locked)
+ if (atomic_dec_and_lock(atomic, &lockp->sp_lock)) {
lockp->sp_owner = current;
-
- return locked;
+ return 1;
+ }
+ return 0;
}
static inline void _ssi_deinit_spin_lock(SPIN_LOCK_T *lockp _SSI_LOCK_WHERE)
@@ -418,18 +414,15 @@
static inline int _ssi_try_lock_softirq_spin_lock(SOFTIRQ_SPIN_LOCK_T *lockp _SSI_LOCK_WHERE)
{
- int locked;
-
_SSI_LOCK_ASSERT_INITED(lockp);
_SSI_LOCK_ASSERT(lockp->isp_owner != current);
local_bh_disable();
- locked = spin_trylock(&lockp->isp_lock);
- if (locked)
+ if (spin_trylock(&lockp->isp_lock)) {
lockp->isp_owner = current;
- else
- local_bh_enable();
-
- return locked;
+ return 1;
+ }
+ local_bh_enable();
+ return 0;
}
static inline void _ssi_deinit_softirq_spin_lock(SOFTIRQ_SPIN_LOCK_T *lockp _SSI_LOCK_WHERE)
@@ -546,20 +539,18 @@
static inline int _ssi_try_lock_hardirq_spin_lock(HARDIRQ_SPIN_LOCK_T *lockp _SSI_LOCK_WHERE)
{
- int locked;
unsigned long flags;
_SSI_LOCK_ASSERT_INITED(lockp);
_SSI_LOCK_ASSERT(lockp->isp_owner != current);
local_irq_save(flags);
- locked = spin_trylock(&lockp->isp_lock);
- if (locked) {
+ if (spin_trylock(&lockp->isp_lock)) {
lockp->isp_owner = current;
lockp->isp_flags = flags;
- } else
- local_irq_set(flags);
-
- return locked;
+ return 1;
+ }
+ local_irq_set(flags);
+ return 0;
}
static inline void _ssi_deinit_hardirq_spin_lock(HARDIRQ_SPIN_LOCK_T *lockp _SSI_LOCK_WHERE)
@@ -851,16 +842,15 @@
static inline int _ssi_try_lock_lock(LOCK_T *lockp _SSI_LOCK_WHERE)
{
- int locked;
-
_SSI_LOCK_ASSERT_INITED(lockp);
_SSI_LOCK_ASSERT(lockp->sl_owner != current);
_SSI_LOCK_ASSERT(!in_interrupt());
- locked = !down_trylock(&lockp->sl_semaphore);
- if (locked)
+ if (down_trylock(&lockp->sl_semaphore)) {
lockp->sl_owner = current;
+ return 1;
+ }
- return locked;
+ return 0;
}
static inline void _ssi_unlock_lock(LOCK_T *lockp _SSI_LOCK_WHERE)
@@ -1016,16 +1006,14 @@
static inline int _ssi_try_lock_excl_rw_lock(RW_LOCK_T *lockp _SSI_LOCK_WHERE)
{
- int locked;
-
_SSI_LOCK_ASSERT_INITED(lockp);
_SSI_LOCK_ASSERT(!in_interrupt());
_SSI_LOCK_ASSERT(lockp->rwsl_owner != current);
- locked = down_write_trylock(&lockp->rwsl_semaphore);
- if (locked)
+ if (down_write_trylock(&lockp->rwsl_semaphore)) {
lockp->rwsl_owner = current;
-
- return locked;
+ return 1;
+ }
+ return 0;
}
static inline void _ssi_unlock_excl_rw_lock(RW_LOCK_T *lockp _SSI_LOCK_WHERE)
@@ -1842,7 +1830,11 @@
return retval;
}
-static inline void _ssi_wait_event(EVENT_T *eventp, int intr, int *was_intrp
+#ifdef _CLUSTER_OUTLINE
+
+/* Don't inline this one, it uses too much stack */
+
+void _ssi_wait_event(EVENT_T *eventp, int intr, int *was_intrp
_SSI_LOCK_WHERE)
{
EVENT_WAIT_T evwait;
@@ -1897,6 +1889,10 @@
list_del(&evwait.ew_waitlist);
spin_unlock_irqrestore(&eventp->ev_lock, flags);
}
+#else
+extern void _ssi_wait_event(EVENT_T *eventp, int intr, int *was_intrp
+ _SSI_LOCK_WHERE);
+#endif
static inline void _ssi_signal_event(EVENT_T *eventp _SSI_LOCK_WHERE)
{