* privatize various functions in sched.h
@ 2002-11-15 10:54 William Lee Irwin III
2002-11-15 11:28 ` William Lee Irwin III
2002-11-15 12:49 ` William Lee Irwin III
0 siblings, 2 replies; 4+ messages in thread
From: William Lee Irwin III @ 2002-11-15 10:54 UTC (permalink / raw)
To: kernel-janitor-discuss; +Cc: linux-kernel
This removes a bunch of inlines used only in isolated places from sched.h
sched.h has too bad of a reputation as a "garbage can" header, so this
aims to trim down the noise by taking functions that are private, making
them private, and removing them from sched.h
There are some other rarely used macros and inlines that could also very
well stand to simply be open-coded at the two or three callsites.
(1) task_cpu() / set_task_cpu()
used only by sched.c and proc_pid_stat(), so privatize to sched.c
and open-code task->thread_info->cpu in proc_pid_stat(), the sole
user of task_cpu() outside sched.h
(2) has_pending_signals() is used only in signal.c
privatize it
(3) eldest_child(), youngest_child(), elder_sibling(), younger_sibling()
used only in sched.c, except for youngest_child(), which is
completely unused
privatize them and remove youngest_child() completely
fs/proc/array.c | 2 -
include/linux/sched.h | 82 --------------------------------------------------
kernel/sched.c | 32 +++++++++++++++++++
kernel/signal.c | 30 ++++++++++++++++++
4 files changed, 63 insertions(+), 83 deletions(-)
diff -urpN mm3-2.5.47/fs/proc/array.c cleanup-2.5.47-1/fs/proc/array.c
--- mm3-2.5.47/fs/proc/array.c 2002-11-10 19:28:18.000000000 -0800
+++ cleanup-2.5.47-1/fs/proc/array.c 2002-11-15 01:36:33.000000000 -0800
@@ -389,7 +389,7 @@ int proc_pid_stat(struct task_struct *ta
task->nswap,
task->cnswap,
task->exit_signal,
- task_cpu(task),
+ task->thread_info->cpu,
task->rt_priority,
task->policy);
if(mm)
diff -urpN mm3-2.5.47/include/linux/sched.h cleanup-2.5.47-1/include/linux/sched.h
--- mm3-2.5.47/include/linux/sched.h 2002-11-10 19:28:04.000000000 -0800
+++ cleanup-2.5.47-1/include/linux/sched.h 2002-11-15 01:50:53.000000000 -0800
@@ -545,36 +545,6 @@ extern int kill_proc(pid_t, int, int);
extern int do_sigaction(int, const struct k_sigaction *, struct k_sigaction *);
extern int do_sigaltstack(const stack_t *, stack_t *, unsigned long);
-/*
- * Re-calculate pending state from the set of locally pending
- * signals, globally pending signals, and blocked signals.
- */
-static inline int has_pending_signals(sigset_t *signal, sigset_t *blocked)
-{
- unsigned long ready;
- long i;
-
- switch (_NSIG_WORDS) {
- default:
- for (i = _NSIG_WORDS, ready = 0; --i >= 0 ;)
- ready |= signal->sig[i] &~ blocked->sig[i];
- break;
-
- case 4: ready = signal->sig[3] &~ blocked->sig[3];
- ready |= signal->sig[2] &~ blocked->sig[2];
- ready |= signal->sig[1] &~ blocked->sig[1];
- ready |= signal->sig[0] &~ blocked->sig[0];
- break;
-
- case 2: ready = signal->sig[1] &~ blocked->sig[1];
- ready |= signal->sig[0] &~ blocked->sig[0];
- break;
-
- case 1: ready = signal->sig[0] &~ blocked->sig[0];
- }
- return ready != 0;
-}
-
/* True if we are on the alternate signal stack. */
static inline int on_sig_stack(unsigned long sp)
@@ -782,30 +752,6 @@ static inline void remove_wait_queue_loc
add_parent(p, (p)->parent); \
} while (0)
-static inline struct task_struct *eldest_child(struct task_struct *p)
-{
- if (list_empty(&p->children)) return NULL;
- return list_entry(p->children.next,struct task_struct,sibling);
-}
-
-static inline struct task_struct *youngest_child(struct task_struct *p)
-{
- if (list_empty(&p->children)) return NULL;
- return list_entry(p->children.prev,struct task_struct,sibling);
-}
-
-static inline struct task_struct *older_sibling(struct task_struct *p)
-{
- if (p->sibling.prev==&p->parent->children) return NULL;
- return list_entry(p->sibling.prev,struct task_struct,sibling);
-}
-
-static inline struct task_struct *younger_sibling(struct task_struct *p)
-{
- if (p->sibling.next==&p->parent->children) return NULL;
- return list_entry(p->sibling.next,struct task_struct,sibling);
-}
-
#define next_task(p) list_entry((p)->tasks.next, struct task_struct, tasks)
#define prev_task(p) list_entry((p)->tasks.prev, struct task_struct, tasks)
@@ -979,34 +925,6 @@ static inline void cond_resched_lock(spi
extern FASTCALL(void recalc_sigpending_tsk(struct task_struct *t));
extern void recalc_sigpending(void);
-/*
- * Wrappers for p->thread_info->cpu access. No-op on UP.
- */
-#ifdef CONFIG_SMP
-
-static inline unsigned int task_cpu(struct task_struct *p)
-{
- return p->thread_info->cpu;
-}
-
-static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)
-{
- p->thread_info->cpu = cpu;
-}
-
-#else
-
-static inline unsigned int task_cpu(struct task_struct *p)
-{
- return 0;
-}
-
-static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)
-{
-}
-
-#endif /* CONFIG_SMP */
-
#endif /* __KERNEL__ */
#endif
diff -urpN mm3-2.5.47/kernel/sched.c cleanup-2.5.47-1/kernel/sched.c
--- mm3-2.5.47/kernel/sched.c 2002-11-14 23:42:02.000000000 -0800
+++ cleanup-2.5.47-1/kernel/sched.c 2002-11-15 01:47:13.000000000 -0800
@@ -162,6 +162,20 @@ struct runqueue {
static struct runqueue runqueues[NR_CPUS] __cacheline_aligned;
+/*
+ * Wrappers for p->thread_info->cpu access. No-op on UP.
+ */
+#ifdef CONFIG_SMP
+#define task_cpu(task) ({(task)->thread_info->cpu; })
+static inline void set_task_cpu(task_t *task, int cpu)
+{
+ task->thread_info->cpu = cpu;
+}
+#else
+#define task_cpu(task) 0
+#define set_task_cpu(task) do { } while (0)
+#endif
+
#define cpu_rq(cpu) (runqueues + (cpu))
#define this_rq() cpu_rq(smp_processor_id())
#define task_rq(p) cpu_rq(task_cpu(p))
@@ -1844,6 +1858,24 @@ out_unlock:
return retval;
}
+static inline struct task_struct *eldest_child(struct task_struct *p)
+{
+ if (list_empty(&p->children)) return NULL;
+ return list_entry(p->children.next,struct task_struct,sibling);
+}
+
+static inline struct task_struct *older_sibling(struct task_struct *p)
+{
+ if (p->sibling.prev==&p->parent->children) return NULL;
+ return list_entry(p->sibling.prev,struct task_struct,sibling);
+}
+
+static inline struct task_struct *younger_sibling(struct task_struct *p)
+{
+ if (p->sibling.next==&p->parent->children) return NULL;
+ return list_entry(p->sibling.next,struct task_struct,sibling);
+}
+
static void show_task(task_t * p)
{
unsigned long free = 0;
diff -urpN mm3-2.5.47/kernel/signal.c cleanup-2.5.47-1/kernel/signal.c
--- mm3-2.5.47/kernel/signal.c 2002-11-10 19:28:10.000000000 -0800
+++ cleanup-2.5.47-1/kernel/signal.c 2002-11-15 01:51:09.000000000 -0800
@@ -160,6 +160,36 @@ int max_queued_signals = 1024;
static int
__send_sig_info(int sig, struct siginfo *info, struct task_struct *p);
+/*
+ * Re-calculate pending state from the set of locally pending
+ * signals, globally pending signals, and blocked signals.
+ */
+static inline int has_pending_signals(sigset_t *signal, sigset_t *blocked)
+{
+ unsigned long ready;
+ long i;
+
+ switch (_NSIG_WORDS) {
+ default:
+ for (i = _NSIG_WORDS, ready = 0; --i >= 0 ;)
+ ready |= signal->sig[i] &~ blocked->sig[i];
+ break;
+
+ case 4: ready = signal->sig[3] &~ blocked->sig[3];
+ ready |= signal->sig[2] &~ blocked->sig[2];
+ ready |= signal->sig[1] &~ blocked->sig[1];
+ ready |= signal->sig[0] &~ blocked->sig[0];
+ break;
+
+ case 2: ready = signal->sig[1] &~ blocked->sig[1];
+ ready |= signal->sig[0] &~ blocked->sig[0];
+ break;
+
+ case 1: ready = signal->sig[0] &~ blocked->sig[0];
+ }
+ return ready != 0;
+}
+
#define PENDING(p,b) has_pending_signals(&(p)->signal, (b))
void recalc_sigpending_tsk(struct task_struct *t)
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: privatize various functions in sched.h
2002-11-15 10:54 privatize various functions in sched.h William Lee Irwin III
@ 2002-11-15 11:28 ` William Lee Irwin III
2002-11-15 19:07 ` William Lee Irwin III
2002-11-15 12:49 ` William Lee Irwin III
1 sibling, 1 reply; 4+ messages in thread
From: William Lee Irwin III @ 2002-11-15 11:28 UTC (permalink / raw)
To: kernel-janitor-discuss, linux-kernel
On Fri, Nov 15, 2002 at 02:54:03AM -0800, William Lee Irwin III wrote:
> This removes a bunch of inlines used only in isolated places from sched.h
Hmm, while I'm at it, this applies atop the previous patch:
This removes d_path() from sched.h and uninlines it. No idea why it was
in sched.h in the first place (or why something this large is inlined).
fs/dcache.c | 19 +++++++++++++++++++
include/linux/dcache.h | 1 +
include/linux/sched.h | 20 --------------------
kernel/ksyms.c | 1 +
4 files changed, 21 insertions(+), 20 deletions(-)
diff -urpN cleanup-2.5.47-2/fs/dcache.c cleanup-2.5.47-3/fs/dcache.c
--- cleanup-2.5.47-2/fs/dcache.c 2002-11-14 23:42:01.000000000 -0800
+++ cleanup-2.5.47-3/fs/dcache.c 2002-11-15 02:45:02.000000000 -0800
@@ -1191,6 +1191,25 @@ global_root:
return retval;
}
+/* write full pathname into buffer and return start of pathname */
+char * d_path(struct dentry *dentry, struct vfsmount *vfsmnt,
+ char *buf, int buflen)
+{
+ char *res;
+ struct vfsmount *rootmnt;
+ struct dentry *root;
+ read_lock(¤t->fs->lock);
+ rootmnt = mntget(current->fs->rootmnt);
+ root = dget(current->fs->root);
+ read_unlock(¤t->fs->lock);
+ spin_lock(&dcache_lock);
+ res = __d_path(dentry, vfsmnt, root, rootmnt, buf, buflen);
+ spin_unlock(&dcache_lock);
+ dput(root);
+ mntput(rootmnt);
+ return res;
+}
+
/*
* NOTE! The user-level library version returns a
* character pointer. The kernel system call just
diff -urpN cleanup-2.5.47-2/include/linux/dcache.h cleanup-2.5.47-3/include/linux/dcache.h
--- cleanup-2.5.47-2/include/linux/dcache.h 2002-11-14 23:42:02.000000000 -0800
+++ cleanup-2.5.47-3/include/linux/dcache.h 2002-11-15 02:41:37.000000000 -0800
@@ -240,6 +240,7 @@ extern int d_validate(struct dentry *, s
extern char * __d_path(struct dentry *, struct vfsmount *, struct dentry *,
struct vfsmount *, char *, int);
+extern char * d_path(struct dentry *, struct vfsmount *, char *, int);
/* Allocation counts.. */
diff -urpN cleanup-2.5.47-2/include/linux/sched.h cleanup-2.5.47-3/include/linux/sched.h
--- cleanup-2.5.47-2/include/linux/sched.h 2002-11-15 01:50:53.000000000 -0800
+++ cleanup-2.5.47-3/include/linux/sched.h 2002-11-15 02:42:06.000000000 -0800
@@ -794,26 +794,6 @@ static inline void task_unlock(struct ta
{
spin_unlock(&p->alloc_lock);
}
-
-/* write full pathname into buffer and return start of pathname */
-static inline char * d_path(struct dentry *dentry, struct vfsmount *vfsmnt,
- char *buf, int buflen)
-{
- char *res;
- struct vfsmount *rootmnt;
- struct dentry *root;
- read_lock(¤t->fs->lock);
- rootmnt = mntget(current->fs->rootmnt);
- root = dget(current->fs->root);
- read_unlock(¤t->fs->lock);
- spin_lock(&dcache_lock);
- res = __d_path(dentry, vfsmnt, root, rootmnt, buf, buflen);
- spin_unlock(&dcache_lock);
- dput(root);
- mntput(rootmnt);
- return res;
-}
-
/**
* get_task_mm - acquire a reference to the task's mm
diff -urpN cleanup-2.5.47-2/kernel/ksyms.c cleanup-2.5.47-3/kernel/ksyms.c
--- cleanup-2.5.47-2/kernel/ksyms.c 2002-11-14 23:42:02.000000000 -0800
+++ cleanup-2.5.47-3/kernel/ksyms.c 2002-11-15 02:43:58.000000000 -0800
@@ -166,6 +166,7 @@ EXPORT_SYMBOL(d_alloc);
EXPORT_SYMBOL(d_alloc_anon);
EXPORT_SYMBOL(d_splice_alias);
EXPORT_SYMBOL(d_lookup);
+EXPORT_SYMBOL(d_path);
EXPORT_SYMBOL(__d_path);
EXPORT_SYMBOL(mark_buffer_dirty);
EXPORT_SYMBOL(end_buffer_io_sync);
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: privatize various functions in sched.h
2002-11-15 11:28 ` William Lee Irwin III
@ 2002-11-15 19:07 ` William Lee Irwin III
0 siblings, 0 replies; 4+ messages in thread
From: William Lee Irwin III @ 2002-11-15 19:07 UTC (permalink / raw)
To: kernel-janitor-discuss, linux-kernel
On Fri, Nov 15, 2002 at 02:54:03AM -0800, William Lee Irwin III wrote:
>> This removes a bunch of inlines used only in isolated places from sched.h
On Fri, Nov 15, 2002 at 03:28:36AM -0800, William Lee Irwin III wrote:
> Hmm, while I'm at it, this applies atop the previous patch:
> This removes d_path() from sched.h and uninlines it. No idea why it was
> in sched.h in the first place (or why something this large is inlined).
Atop the d_path() removal patch:
__d_path() may be privatized since umsdos is broken anyway.
fs/dcache.c | 6 +++---
include/linux/dcache.h | 2 --
kernel/ksyms.c | 1 -
3 files changed, 3 insertions(+), 6 deletions(-)
diff -urpN cleanup-2.5.47-5/fs/dcache.c cleanup-2.5.47-6/fs/dcache.c
--- cleanup-2.5.47-5/fs/dcache.c 2002-11-15 02:45:02.000000000 -0800
+++ cleanup-2.5.47-6/fs/dcache.c 2002-11-15 10:19:33.000000000 -0800
@@ -1136,9 +1136,9 @@ void d_move(struct dentry * dentry, stru
*
* "buflen" should be %PAGE_SIZE or more. Caller holds the dcache_lock.
*/
-char * __d_path(struct dentry *dentry, struct vfsmount *vfsmnt,
- struct dentry *root, struct vfsmount *rootmnt,
- char *buffer, int buflen)
+static char * __d_path( struct dentry *dentry, struct vfsmount *vfsmnt,
+ struct dentry *root, struct vfsmount *rootmnt,
+ char *buffer, int buflen)
{
char * end = buffer+buflen;
char * retval;
diff -urpN cleanup-2.5.47-5/include/linux/dcache.h cleanup-2.5.47-6/include/linux/dcache.h
--- cleanup-2.5.47-5/include/linux/dcache.h 2002-11-15 02:41:37.000000000 -0800
+++ cleanup-2.5.47-6/include/linux/dcache.h 2002-11-15 10:19:01.000000000 -0800
@@ -238,8 +238,6 @@ extern struct dentry * __d_lookup(struct
/* validate "insecure" dentry pointer */
extern int d_validate(struct dentry *, struct dentry *);
-extern char * __d_path(struct dentry *, struct vfsmount *, struct dentry *,
- struct vfsmount *, char *, int);
extern char * d_path(struct dentry *, struct vfsmount *, char *, int);
/* Allocation counts.. */
diff -urpN cleanup-2.5.47-5/kernel/ksyms.c cleanup-2.5.47-6/kernel/ksyms.c
--- cleanup-2.5.47-5/kernel/ksyms.c 2002-11-15 02:43:58.000000000 -0800
+++ cleanup-2.5.47-6/kernel/ksyms.c 2002-11-15 10:19:50.000000000 -0800
@@ -167,7 +167,6 @@ EXPORT_SYMBOL(d_alloc_anon);
EXPORT_SYMBOL(d_splice_alias);
EXPORT_SYMBOL(d_lookup);
EXPORT_SYMBOL(d_path);
-EXPORT_SYMBOL(__d_path);
EXPORT_SYMBOL(mark_buffer_dirty);
EXPORT_SYMBOL(end_buffer_io_sync);
EXPORT_SYMBOL(__mark_inode_dirty);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: privatize various functions in sched.h
2002-11-15 10:54 privatize various functions in sched.h William Lee Irwin III
2002-11-15 11:28 ` William Lee Irwin III
@ 2002-11-15 12:49 ` William Lee Irwin III
1 sibling, 0 replies; 4+ messages in thread
From: William Lee Irwin III @ 2002-11-15 12:49 UTC (permalink / raw)
To: kernel-janitor-discuss, linux-kernel
On Fri, Nov 15, 2002 at 02:54:03AM -0800, William Lee Irwin III wrote:
> (1) task_cpu() / set_task_cpu()
As pointed out by willy@debian.org, set_task_cpu() needs a cpu argument
for the non-SMP case:
This removes a bunch of inlines used only in isolated places from sched.h
sched.h has too bad of a reputation as a "garbage can" header, so this
aims to trim down the noise by taking functions that are private, making
them private, and removing them from sched.h
(1) task_cpu() / set_task_cpu()
used only by sched.c and proc_pid_stat(), so privatize to sched.c
and open-code task->thread_info->cpu in proc_pid_stat()
(2) has_pending_signals() is used only in signal.c
privatize it
(3) eldest_child(), youngest_child(), elder_sibling(), younger_sibling()
used only in sched.c, except for youngest_child(), which is
completely unused
privatize them
fs/proc/array.c | 2 -
include/linux/sched.h | 82 --------------------------------------------------
kernel/sched.c | 32 +++++++++++++++++++
kernel/signal.c | 30 ++++++++++++++++++
4 files changed, 63 insertions(+), 83 deletions(-)
diff -urpN mm3-2.5.47/fs/proc/array.c cleanup-2.5.47-1/fs/proc/array.c
--- mm3-2.5.47/fs/proc/array.c 2002-11-10 19:28:18.000000000 -0800
+++ cleanup-2.5.47-1/fs/proc/array.c 2002-11-15 01:36:33.000000000 -0800
@@ -389,7 +389,7 @@ int proc_pid_stat(struct task_struct *ta
task->nswap,
task->cnswap,
task->exit_signal,
- task_cpu(task),
+ task->thread_info->cpu,
task->rt_priority,
task->policy);
if(mm)
diff -urpN mm3-2.5.47/include/linux/sched.h cleanup-2.5.47-1/include/linux/sched.h
--- mm3-2.5.47/include/linux/sched.h 2002-11-10 19:28:04.000000000 -0800
+++ cleanup-2.5.47-1/include/linux/sched.h 2002-11-15 01:50:53.000000000 -0800
@@ -545,36 +545,6 @@ extern int kill_proc(pid_t, int, int);
extern int do_sigaction(int, const struct k_sigaction *, struct k_sigaction *);
extern int do_sigaltstack(const stack_t *, stack_t *, unsigned long);
-/*
- * Re-calculate pending state from the set of locally pending
- * signals, globally pending signals, and blocked signals.
- */
-static inline int has_pending_signals(sigset_t *signal, sigset_t *blocked)
-{
- unsigned long ready;
- long i;
-
- switch (_NSIG_WORDS) {
- default:
- for (i = _NSIG_WORDS, ready = 0; --i >= 0 ;)
- ready |= signal->sig[i] &~ blocked->sig[i];
- break;
-
- case 4: ready = signal->sig[3] &~ blocked->sig[3];
- ready |= signal->sig[2] &~ blocked->sig[2];
- ready |= signal->sig[1] &~ blocked->sig[1];
- ready |= signal->sig[0] &~ blocked->sig[0];
- break;
-
- case 2: ready = signal->sig[1] &~ blocked->sig[1];
- ready |= signal->sig[0] &~ blocked->sig[0];
- break;
-
- case 1: ready = signal->sig[0] &~ blocked->sig[0];
- }
- return ready != 0;
-}
-
/* True if we are on the alternate signal stack. */
static inline int on_sig_stack(unsigned long sp)
@@ -782,30 +752,6 @@ static inline void remove_wait_queue_loc
add_parent(p, (p)->parent); \
} while (0)
-static inline struct task_struct *eldest_child(struct task_struct *p)
-{
- if (list_empty(&p->children)) return NULL;
- return list_entry(p->children.next,struct task_struct,sibling);
-}
-
-static inline struct task_struct *youngest_child(struct task_struct *p)
-{
- if (list_empty(&p->children)) return NULL;
- return list_entry(p->children.prev,struct task_struct,sibling);
-}
-
-static inline struct task_struct *older_sibling(struct task_struct *p)
-{
- if (p->sibling.prev==&p->parent->children) return NULL;
- return list_entry(p->sibling.prev,struct task_struct,sibling);
-}
-
-static inline struct task_struct *younger_sibling(struct task_struct *p)
-{
- if (p->sibling.next==&p->parent->children) return NULL;
- return list_entry(p->sibling.next,struct task_struct,sibling);
-}
-
#define next_task(p) list_entry((p)->tasks.next, struct task_struct, tasks)
#define prev_task(p) list_entry((p)->tasks.prev, struct task_struct, tasks)
@@ -979,34 +925,6 @@ static inline void cond_resched_lock(spi
extern FASTCALL(void recalc_sigpending_tsk(struct task_struct *t));
extern void recalc_sigpending(void);
-/*
- * Wrappers for p->thread_info->cpu access. No-op on UP.
- */
-#ifdef CONFIG_SMP
-
-static inline unsigned int task_cpu(struct task_struct *p)
-{
- return p->thread_info->cpu;
-}
-
-static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)
-{
- p->thread_info->cpu = cpu;
-}
-
-#else
-
-static inline unsigned int task_cpu(struct task_struct *p)
-{
- return 0;
-}
-
-static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)
-{
-}
-
-#endif /* CONFIG_SMP */
-
#endif /* __KERNEL__ */
#endif
diff -urpN mm3-2.5.47/kernel/sched.c cleanup-2.5.47-1/kernel/sched.c
--- mm3-2.5.47/kernel/sched.c 2002-11-14 23:42:02.000000000 -0800
+++ cleanup-2.5.47-1/kernel/sched.c 2002-11-15 01:47:13.000000000 -0800
@@ -162,6 +162,20 @@ struct runqueue {
static struct runqueue runqueues[NR_CPUS] __cacheline_aligned;
+/*
+ * Wrappers for p->thread_info->cpu access. No-op on UP.
+ */
+#ifdef CONFIG_SMP
+#define task_cpu(task) ({(task)->thread_info->cpu; })
+static inline void set_task_cpu(task_t *task, int cpu)
+{
+ task->thread_info->cpu = cpu;
+}
+#else
+#define task_cpu(task) 0
+#define set_task_cpu(task, cpu) do { } while (0)
+#endif
+
#define cpu_rq(cpu) (runqueues + (cpu))
#define this_rq() cpu_rq(smp_processor_id())
#define task_rq(p) cpu_rq(task_cpu(p))
@@ -1844,6 +1858,24 @@ out_unlock:
return retval;
}
+static inline struct task_struct *eldest_child(struct task_struct *p)
+{
+ if (list_empty(&p->children)) return NULL;
+ return list_entry(p->children.next,struct task_struct,sibling);
+}
+
+static inline struct task_struct *older_sibling(struct task_struct *p)
+{
+ if (p->sibling.prev==&p->parent->children) return NULL;
+ return list_entry(p->sibling.prev,struct task_struct,sibling);
+}
+
+static inline struct task_struct *younger_sibling(struct task_struct *p)
+{
+ if (p->sibling.next==&p->parent->children) return NULL;
+ return list_entry(p->sibling.next,struct task_struct,sibling);
+}
+
static void show_task(task_t * p)
{
unsigned long free = 0;
diff -urpN mm3-2.5.47/kernel/signal.c cleanup-2.5.47-1/kernel/signal.c
--- mm3-2.5.47/kernel/signal.c 2002-11-10 19:28:10.000000000 -0800
+++ cleanup-2.5.47-1/kernel/signal.c 2002-11-15 01:51:09.000000000 -0800
@@ -160,6 +160,36 @@ int max_queued_signals = 1024;
static int
__send_sig_info(int sig, struct siginfo *info, struct task_struct *p);
+/*
+ * Re-calculate pending state from the set of locally pending
+ * signals, globally pending signals, and blocked signals.
+ */
+static inline int has_pending_signals(sigset_t *signal, sigset_t *blocked)
+{
+ unsigned long ready;
+ long i;
+
+ switch (_NSIG_WORDS) {
+ default:
+ for (i = _NSIG_WORDS, ready = 0; --i >= 0 ;)
+ ready |= signal->sig[i] &~ blocked->sig[i];
+ break;
+
+ case 4: ready = signal->sig[3] &~ blocked->sig[3];
+ ready |= signal->sig[2] &~ blocked->sig[2];
+ ready |= signal->sig[1] &~ blocked->sig[1];
+ ready |= signal->sig[0] &~ blocked->sig[0];
+ break;
+
+ case 2: ready = signal->sig[1] &~ blocked->sig[1];
+ ready |= signal->sig[0] &~ blocked->sig[0];
+ break;
+
+ case 1: ready = signal->sig[0] &~ blocked->sig[0];
+ }
+ return ready != 0;
+}
+
#define PENDING(p,b) has_pending_signals(&(p)->signal, (b))
void recalc_sigpending_tsk(struct task_struct *t)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-11-15 19:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-15 10:54 privatize various functions in sched.h William Lee Irwin III
2002-11-15 11:28 ` William Lee Irwin III
2002-11-15 19:07 ` William Lee Irwin III
2002-11-15 12:49 ` William Lee Irwin III
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox