[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4DA2BC4E.4010000@cn.fujitsu.com>
Date: Mon, 11 Apr 2011 16:31:10 +0800
From: Lai Jiangshan <laijs@...fujitsu.com>
To: paulmck@...ux.vnet.ibm.com
CC: "H. Peter Anvin" <hpa@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Michal Marek <mmarek@...e.cz>,
Jan Beulich <JBeulich@...ell.com>, Ingo Molnar <mingo@...e.hu>,
Alexander van Heukelum <heukelum@...tmail.fm>,
Dipankar Sarma <dipankar@...ibm.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Sam Ravnborg <sam@...nborg.org>,
David Howells <dhowells@...hat.com>,
Oleg Nesterov <oleg@...hat.com>,
Roland McGrath <roland@...hat.com>,
linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [RFC PATCH 4/5] RCU: Add TASK_RCU_OFFSET
On 04/11/2011 01:12 PM, Paul E. McKenney wrote:
> -static inline struct task_struct *next_thread(const struct task_struct *p)
> -{
> - return list_entry_rcu(p->thread_group.next,
> - struct task_struct, thread_group);
> -}
> +/* Avoid #include hell for inlining rcu_read_lock(). */
> +#define next_thread(p) \
> + list_entry_rcu((p)->thread_group.next, struct task_struct, thread_group)
>
It is strange for me.
The user of the API "next_thread(p)" must has two headers included, sched.h and rculist.h
I know this is a very popular pattern of user space code, is it OK for kernel?
I think a file(even a header file) uses API(Marco), it should includes the the corresponding
headers, it reduces surprises(example, the name of "next_thread()" has no "rcu",
it is not expected that rcuxxxx.h is required).
I admit the work will become very much simpler if this pattern is allowed.
man fcntl:
#include <unistd.h>
#include <fcntl.h>
int fcntl(int fd, int cmd, ... /* arg */ );
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists