Prev: [01/45] UBI: fix volume creation input checking
Next: [09/45] r8169: Fix receive buffer length when MTU is between 1515 and 1536
From: Greg KH on 30 Mar 2010 19:10 2.6.27-stable review patch. If anyone has any objections, please let us know. ------------------ From: Jiri Slaby <jslaby(a)suse.cz> commit 3e10e716abf3c71bdb5d86b8f507f9e72236c9cd upstream. We want to be sure that compiler fetches the limit variable only once, so add helpers for fetching current and maximal resource limits which do that. Add them to sched.h (instead of resource.h) due to circular dependency sched.h->resource.h->task_struct Alternative would be to create a separate res_access.h or similar. Signed-off-by: Jiri Slaby <jslaby(a)suse.cz> Cc: James Morris <jmorris(a)namei.org> Cc: Heiko Carstens <heiko.carstens(a)de.ibm.com> Cc: Andrew Morton <akpm(a)linux-foundation.org> Cc: Ingo Molnar <mingo(a)elte.hu> Signed-off-by: Greg Kroah-Hartman <gregkh(a)suse.de> --- include/linux/sched.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -2232,6 +2232,28 @@ static inline void mm_init_owner(struct #define TASK_STATE_TO_CHAR_STR "RSDTtZX" +static inline unsigned long task_rlimit(const struct task_struct *tsk, + unsigned int limit) +{ + return ACCESS_ONCE(tsk->signal->rlim[limit].rlim_cur); +} + +static inline unsigned long task_rlimit_max(const struct task_struct *tsk, + unsigned int limit) +{ + return ACCESS_ONCE(tsk->signal->rlim[limit].rlim_max); +} + +static inline unsigned long rlimit(unsigned int limit) +{ + return task_rlimit(current, limit); +} + +static inline unsigned long rlimit_max(unsigned int limit) +{ + return task_rlimit_max(current, limit); +} + #endif /* __KERNEL__ */ #endif -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |