2008-06-18 10:18:13

by Rakib Mullick

[permalink] [raw]
Subject: [PATCH]include/linux/threads.h : Removes extra checking CONFIG_BASE_SMALL

In existing code for defining PID_MAX_DEFAULT and PID_MAX_LIMIT,a check for
CONFIG_BASE_SMALL has been made twice. This patch reduces an extra checking.


Signed-off-by: Md.Rakib H. Mullick ( [email protected])

--- linux-2.6.25/include/linux/threads.h.orig 2008-06-16
11:46:42.000000000 +0600
+++ linux-2.6.25/include/linux/threads.h 2008-06-17 19:41:19.462424632 +0600
@@ -24,13 +24,17 @@
/*
* This controls the default maximum pid allocated to a process
*/
-#define PID_MAX_DEFAULT (CONFIG_BASE_SMALL ? 0x1000 : 0x8000)
-
/*
* A maximum of 4 million PIDs should be enough for a while.
* [NOTE: PID/TIDs are limited to 2^29 ~= 500+ million, see futex.h.]
*/
-#define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \
- (sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT))
+#if (CONFIG_BASE_SMALL)
+#define PID_MAX_DEFAULT 0x1000
+#define PID_MAX_LIMIT (PAGE_SIZE * 8)
+#else
+#define PID_MAX_DEFAULT 0x8000
+#define PID_MAX_LIMIT (sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT)
+#endif
+

#endif


2008-06-18 11:41:19

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH]include/linux/threads.h : Removes extra checking CONFIG_BASE_SMALL


* Rakib Mullick <[email protected]> wrote:

> In existing code for defining PID_MAX_DEFAULT and PID_MAX_LIMIT,a
> check for CONFIG_BASE_SMALL has been made twice. This patch reduces an
> extra checking.

hm, why should we do this change? The compiler will optimize away the
check and it's cleaner without an extra #ifdef.

Ingo