Re: [PATCH 1/3] sched: Move the priority specific bits into a new header file.

2014-02-10 Thread Dongsheng Yang

Hi Steven,

On 02/10/2014 10:09 PM, Steven Rostedt wrote:



That's why you have:

+++ b/include/linux/sched/prio.h
@@ -0,0 +1,23 @@
+#ifndef _SCHED_PRIO_H
+#define _SCHED_PRIO_H

The first time a header gets included, it checks if _SCHED_PRIO_H is
defined, if not, it defines it and continues. Otherwise it skips the
content of the file.

This is so standard practice that CPP (C Pre-Processor) optimizes this
by checking if this exists and caches it. It wont even open the file
the second time it sees it included.


Wow, yes. Thank you for your kind explanation. :)


-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] sched: Move the priority specific bits into a new header file.

2014-02-10 Thread Steven Rostedt
On Mon, 10 Feb 2014 10:56:34 +0800
Dongsheng Yang  wrote:

> >> diff --git a/include/linux/sched.h b/include/linux/sched.h
> >> index 68a0e84..ba1b732 100644
> >> --- a/include/linux/sched.h
> >> +++ b/include/linux/sched.h
> >> @@ -3,6 +3,10 @@
> >>   
> >>   #include 
> >>   
> >> +#ifndef _SCHED_PRIO_H
> >> +#include 
> >> +#endif /* #ifndef _SCHED_PRIO_H */
> > It seems you don't need to use #ifndef-#endif pair to include a header
> > file?
> 
> Sorry for the late reply, coming back from vacation for Chinese Spring 
> Festival.
> 
> The reason I use #ifndef-#endif here is that there are lots of files,
>   such as kernel/sched/sched.h, are including  and
> . And both of them are including prio.h.
> 
> I am not sure should we avoid reincluding a file and how.
> 
> Could you help to give me some suggestion of it. Thanx :)


That's why you have:

+++ b/include/linux/sched/prio.h
@@ -0,0 +1,23 @@
+#ifndef _SCHED_PRIO_H
+#define _SCHED_PRIO_H

The first time a header gets included, it checks if _SCHED_PRIO_H is
defined, if not, it defines it and continues. Otherwise it skips the
content of the file.

This is so standard practice that CPP (C Pre-Processor) optimizes this
by checking if this exists and caches it. It wont even open the file
the second time it sees it included.

-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] sched: Move the priority specific bits into a new header file.

2014-02-10 Thread Dongsheng Yang
Some bits about priority are defined in linux/sched/rt.h, but
some of them are not only for rt scheduler, such as MAX_PRIO.

This patch move them all into a new header file, linux/sched/prio.h.

Signed-off-by: Dongsheng Yang 
---
 include/linux/sched.h  |  1 +
 include/linux/sched/prio.h | 23 +++
 include/linux/sched/rt.h   | 19 +--
 3 files changed, 25 insertions(+), 18 deletions(-)
 create mode 100644 include/linux/sched/prio.h

diff --git a/include/linux/sched.h b/include/linux/sched.h
index a781dec..5aa0329 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -54,6 +54,7 @@ struct sched_param {
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
diff --git a/include/linux/sched/prio.h b/include/linux/sched/prio.h
new file mode 100644
index 000..9382ba8
--- /dev/null
+++ b/include/linux/sched/prio.h
@@ -0,0 +1,23 @@
+#ifndef _SCHED_PRIO_H
+#define _SCHED_PRIO_H
+
+/*
+ * Priority of a process goes from 0..MAX_PRIO-1, valid RT
+ * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
+ * tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority
+ * values are inverted: lower p->prio value means higher priority.
+ *
+ * The MAX_USER_RT_PRIO value allows the actual maximum
+ * RT priority to be separate from the value exported to
+ * user-space.  This allows kernel threads to set their
+ * priority to a value higher than any user task. Note:
+ * MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO.
+ */
+
+#define MAX_USER_RT_PRIO   100
+#define MAX_RT_PRIOMAX_USER_RT_PRIO
+
+#define MAX_PRIO   (MAX_RT_PRIO + 40)
+#define DEFAULT_PRIO   (MAX_RT_PRIO + 20)
+
+#endif /* _SCHED_PRIO_H */
diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h
index 34e4ebe..f7453d4 100644
--- a/include/linux/sched/rt.h
+++ b/include/linux/sched/rt.h
@@ -1,24 +1,7 @@
 #ifndef _SCHED_RT_H
 #define _SCHED_RT_H
 
-/*
- * Priority of a process goes from 0..MAX_PRIO-1, valid RT
- * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
- * tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority
- * values are inverted: lower p->prio value means higher priority.
- *
- * The MAX_USER_RT_PRIO value allows the actual maximum
- * RT priority to be separate from the value exported to
- * user-space.  This allows kernel threads to set their
- * priority to a value higher than any user task. Note:
- * MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO.
- */
-
-#define MAX_USER_RT_PRIO   100
-#define MAX_RT_PRIOMAX_USER_RT_PRIO
-
-#define MAX_PRIO   (MAX_RT_PRIO + 40)
-#define DEFAULT_PRIO   (MAX_RT_PRIO + 20)
+#include 
 
 static inline int rt_prio(int prio)
 {
-- 
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] sched: Move the priority specific bits into a new header file.

2014-02-10 Thread Dongsheng Yang
Some bits about priority are defined in linux/sched/rt.h, but
some of them are not only for rt scheduler, such as MAX_PRIO.

This patch move them all into a new header file, linux/sched/prio.h.

Signed-off-by: Dongsheng Yang yangds.f...@cn.fujitsu.com
---
 include/linux/sched.h  |  1 +
 include/linux/sched/prio.h | 23 +++
 include/linux/sched/rt.h   | 19 +--
 3 files changed, 25 insertions(+), 18 deletions(-)
 create mode 100644 include/linux/sched/prio.h

diff --git a/include/linux/sched.h b/include/linux/sched.h
index a781dec..5aa0329 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -54,6 +54,7 @@ struct sched_param {
 #include linux/llist.h
 #include linux/uidgid.h
 #include linux/gfp.h
+#include linux/sched/prio.h
 
 #include asm/processor.h
 
diff --git a/include/linux/sched/prio.h b/include/linux/sched/prio.h
new file mode 100644
index 000..9382ba8
--- /dev/null
+++ b/include/linux/sched/prio.h
@@ -0,0 +1,23 @@
+#ifndef _SCHED_PRIO_H
+#define _SCHED_PRIO_H
+
+/*
+ * Priority of a process goes from 0..MAX_PRIO-1, valid RT
+ * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
+ * tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority
+ * values are inverted: lower p-prio value means higher priority.
+ *
+ * The MAX_USER_RT_PRIO value allows the actual maximum
+ * RT priority to be separate from the value exported to
+ * user-space.  This allows kernel threads to set their
+ * priority to a value higher than any user task. Note:
+ * MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO.
+ */
+
+#define MAX_USER_RT_PRIO   100
+#define MAX_RT_PRIOMAX_USER_RT_PRIO
+
+#define MAX_PRIO   (MAX_RT_PRIO + 40)
+#define DEFAULT_PRIO   (MAX_RT_PRIO + 20)
+
+#endif /* _SCHED_PRIO_H */
diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h
index 34e4ebe..f7453d4 100644
--- a/include/linux/sched/rt.h
+++ b/include/linux/sched/rt.h
@@ -1,24 +1,7 @@
 #ifndef _SCHED_RT_H
 #define _SCHED_RT_H
 
-/*
- * Priority of a process goes from 0..MAX_PRIO-1, valid RT
- * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
- * tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority
- * values are inverted: lower p-prio value means higher priority.
- *
- * The MAX_USER_RT_PRIO value allows the actual maximum
- * RT priority to be separate from the value exported to
- * user-space.  This allows kernel threads to set their
- * priority to a value higher than any user task. Note:
- * MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO.
- */
-
-#define MAX_USER_RT_PRIO   100
-#define MAX_RT_PRIOMAX_USER_RT_PRIO
-
-#define MAX_PRIO   (MAX_RT_PRIO + 40)
-#define DEFAULT_PRIO   (MAX_RT_PRIO + 20)
+#include linux/sched/prio.h
 
 static inline int rt_prio(int prio)
 {
-- 
1.8.2.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] sched: Move the priority specific bits into a new header file.

2014-02-10 Thread Steven Rostedt
On Mon, 10 Feb 2014 10:56:34 +0800
Dongsheng Yang yangds.f...@cn.fujitsu.com wrote:

  diff --git a/include/linux/sched.h b/include/linux/sched.h
  index 68a0e84..ba1b732 100644
  --- a/include/linux/sched.h
  +++ b/include/linux/sched.h
  @@ -3,6 +3,10 @@

#include uapi/linux/sched.h

  +#ifndef _SCHED_PRIO_H
  +#include linux/sched/prio.h
  +#endif /* #ifndef _SCHED_PRIO_H */
  It seems you don't need to use #ifndef-#endif pair to include a header
  file?
 
 Sorry for the late reply, coming back from vacation for Chinese Spring 
 Festival.
 
 The reason I use #ifndef-#endif here is that there are lots of files,
   such as kernel/sched/sched.h, are including linux/sched.h and
 linux/sched/rt.h. And both of them are including prio.h.
 
 I am not sure should we avoid reincluding a file and how.
 
 Could you help to give me some suggestion of it. Thanx :)


That's why you have:

+++ b/include/linux/sched/prio.h
@@ -0,0 +1,23 @@
+#ifndef _SCHED_PRIO_H
+#define _SCHED_PRIO_H

The first time a header gets included, it checks if _SCHED_PRIO_H is
defined, if not, it defines it and continues. Otherwise it skips the
content of the file.

This is so standard practice that CPP (C Pre-Processor) optimizes this
by checking if this exists and caches it. It wont even open the file
the second time it sees it included.

-- Steve
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] sched: Move the priority specific bits into a new header file.

2014-02-10 Thread Dongsheng Yang

Hi Steven,

On 02/10/2014 10:09 PM, Steven Rostedt wrote:



That's why you have:

+++ b/include/linux/sched/prio.h
@@ -0,0 +1,23 @@
+#ifndef _SCHED_PRIO_H
+#define _SCHED_PRIO_H

The first time a header gets included, it checks if _SCHED_PRIO_H is
defined, if not, it defines it and continues. Otherwise it skips the
content of the file.

This is so standard practice that CPP (C Pre-Processor) optimizes this
by checking if this exists and caches it. It wont even open the file
the second time it sees it included.


Wow, yes. Thank you for your kind explanation. :)


-- Steve
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] sched: Move the priority specific bits into a new header file.

2014-02-09 Thread Dongsheng Yang


Hi Namhyung,

On 01/29/2014 01:28 PM, Namhyung Kim wrote:

Hi Dongsheng,

On Mon, 27 Jan 2014 17:15:37 -0500, Dongsheng Yang wrote:

Some bits about priority are defined in linux/sched/rt.h, but
some of them are not only for rt scheduler, such as MAX_PRIO.

This patch move them all into a new header file, linux/sched/prio.h.

Signed-off-by: Dongsheng Yang 
---
  include/linux/sched.h  |  4 
  include/linux/sched/prio.h | 23 +++
  include/linux/sched/rt.h   | 21 +++--
  3 files changed, 30 insertions(+), 18 deletions(-)
  create mode 100644 include/linux/sched/prio.h

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 68a0e84..ba1b732 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -3,6 +3,10 @@
  
  #include 
  
+#ifndef _SCHED_PRIO_H

+#include 
+#endif /* #ifndef _SCHED_PRIO_H */

It seems you don't need to use #ifndef-#endif pair to include a header
file?


Sorry for the late reply, coming back from vacation for Chinese Spring 
Festival.


The reason I use #ifndef-#endif here is that there are lots of files,
 such as kernel/sched/sched.h, are including  and
. And both of them are including prio.h.

I am not sure should we avoid reincluding a file and how.

Could you help to give me some suggestion of it. Thanx :)


Thanks,
Namhyung



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] sched: Move the priority specific bits into a new header file.

2014-02-09 Thread Dongsheng Yang


Hi Namhyung,

On 01/29/2014 01:28 PM, Namhyung Kim wrote:

Hi Dongsheng,

On Mon, 27 Jan 2014 17:15:37 -0500, Dongsheng Yang wrote:

Some bits about priority are defined in linux/sched/rt.h, but
some of them are not only for rt scheduler, such as MAX_PRIO.

This patch move them all into a new header file, linux/sched/prio.h.

Signed-off-by: Dongsheng Yang yangds.f...@cn.fujitsu.com
---
  include/linux/sched.h  |  4 
  include/linux/sched/prio.h | 23 +++
  include/linux/sched/rt.h   | 21 +++--
  3 files changed, 30 insertions(+), 18 deletions(-)
  create mode 100644 include/linux/sched/prio.h

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 68a0e84..ba1b732 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -3,6 +3,10 @@
  
  #include uapi/linux/sched.h
  
+#ifndef _SCHED_PRIO_H

+#include linux/sched/prio.h
+#endif /* #ifndef _SCHED_PRIO_H */

It seems you don't need to use #ifndef-#endif pair to include a header
file?


Sorry for the late reply, coming back from vacation for Chinese Spring 
Festival.


The reason I use #ifndef-#endif here is that there are lots of files,
 such as kernel/sched/sched.h, are including linux/sched.h and
linux/sched/rt.h. And both of them are including prio.h.

I am not sure should we avoid reincluding a file and how.

Could you help to give me some suggestion of it. Thanx :)


Thanks,
Namhyung



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] sched: Move the priority specific bits into a new header file.

2014-01-28 Thread Namhyung Kim
Hi Dongsheng,

On Mon, 27 Jan 2014 17:15:37 -0500, Dongsheng Yang wrote:
> Some bits about priority are defined in linux/sched/rt.h, but
> some of them are not only for rt scheduler, such as MAX_PRIO.
>
> This patch move them all into a new header file, linux/sched/prio.h.
>
> Signed-off-by: Dongsheng Yang 
> ---
>  include/linux/sched.h  |  4 
>  include/linux/sched/prio.h | 23 +++
>  include/linux/sched/rt.h   | 21 +++--
>  3 files changed, 30 insertions(+), 18 deletions(-)
>  create mode 100644 include/linux/sched/prio.h
>
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 68a0e84..ba1b732 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -3,6 +3,10 @@
>  
>  #include 
>  
> +#ifndef _SCHED_PRIO_H
> +#include 
> +#endif /* #ifndef _SCHED_PRIO_H */

It seems you don't need to use #ifndef-#endif pair to include a header
file?

Thanks,
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] sched: Move the priority specific bits into a new header file.

2014-01-28 Thread Namhyung Kim
Hi Dongsheng,

On Mon, 27 Jan 2014 17:15:37 -0500, Dongsheng Yang wrote:
 Some bits about priority are defined in linux/sched/rt.h, but
 some of them are not only for rt scheduler, such as MAX_PRIO.

 This patch move them all into a new header file, linux/sched/prio.h.

 Signed-off-by: Dongsheng Yang yangds.f...@cn.fujitsu.com
 ---
  include/linux/sched.h  |  4 
  include/linux/sched/prio.h | 23 +++
  include/linux/sched/rt.h   | 21 +++--
  3 files changed, 30 insertions(+), 18 deletions(-)
  create mode 100644 include/linux/sched/prio.h

 diff --git a/include/linux/sched.h b/include/linux/sched.h
 index 68a0e84..ba1b732 100644
 --- a/include/linux/sched.h
 +++ b/include/linux/sched.h
 @@ -3,6 +3,10 @@
  
  #include uapi/linux/sched.h
  
 +#ifndef _SCHED_PRIO_H
 +#include linux/sched/prio.h
 +#endif /* #ifndef _SCHED_PRIO_H */

It seems you don't need to use #ifndef-#endif pair to include a header
file?

Thanks,
Namhyung
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] sched: Move the priority specific bits into a new header file.

2014-01-27 Thread Dongsheng Yang
Some bits about priority are defined in linux/sched/rt.h, but
some of them are not only for rt scheduler, such as MAX_PRIO.

This patch move them all into a new header file, linux/sched/prio.h.

Signed-off-by: Dongsheng Yang 
---
 include/linux/sched.h  |  4 
 include/linux/sched/prio.h | 23 +++
 include/linux/sched/rt.h   | 21 +++--
 3 files changed, 30 insertions(+), 18 deletions(-)
 create mode 100644 include/linux/sched/prio.h

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 68a0e84..ba1b732 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -3,6 +3,10 @@
 
 #include 
 
+#ifndef _SCHED_PRIO_H
+#include 
+#endif /* #ifndef _SCHED_PRIO_H */
+
 
 struct sched_param {
int sched_priority;
diff --git a/include/linux/sched/prio.h b/include/linux/sched/prio.h
new file mode 100644
index 000..9382ba8
--- /dev/null
+++ b/include/linux/sched/prio.h
@@ -0,0 +1,23 @@
+#ifndef _SCHED_PRIO_H
+#define _SCHED_PRIO_H
+
+/*
+ * Priority of a process goes from 0..MAX_PRIO-1, valid RT
+ * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
+ * tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority
+ * values are inverted: lower p->prio value means higher priority.
+ *
+ * The MAX_USER_RT_PRIO value allows the actual maximum
+ * RT priority to be separate from the value exported to
+ * user-space.  This allows kernel threads to set their
+ * priority to a value higher than any user task. Note:
+ * MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO.
+ */
+
+#define MAX_USER_RT_PRIO   100
+#define MAX_RT_PRIOMAX_USER_RT_PRIO
+
+#define MAX_PRIO   (MAX_RT_PRIO + 40)
+#define DEFAULT_PRIO   (MAX_RT_PRIO + 20)
+
+#endif /* _SCHED_PRIO_H */
diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h
index 34e4ebe..50409a3 100644
--- a/include/linux/sched/rt.h
+++ b/include/linux/sched/rt.h
@@ -1,24 +1,9 @@
 #ifndef _SCHED_RT_H
 #define _SCHED_RT_H
 
-/*
- * Priority of a process goes from 0..MAX_PRIO-1, valid RT
- * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
- * tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority
- * values are inverted: lower p->prio value means higher priority.
- *
- * The MAX_USER_RT_PRIO value allows the actual maximum
- * RT priority to be separate from the value exported to
- * user-space.  This allows kernel threads to set their
- * priority to a value higher than any user task. Note:
- * MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO.
- */
-
-#define MAX_USER_RT_PRIO   100
-#define MAX_RT_PRIOMAX_USER_RT_PRIO
-
-#define MAX_PRIO   (MAX_RT_PRIO + 40)
-#define DEFAULT_PRIO   (MAX_RT_PRIO + 20)
+#ifndef _SCHED_PRIO_H
+#include 
+#endif /* ifndef _SCHED_PRIO_H */
 
 static inline int rt_prio(int prio)
 {
-- 
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] sched: Move the priority specific bits into a new header file.

2014-01-27 Thread Dongsheng Yang
Some bits about priority are defined in linux/sched/rt.h, but
some of them are not only for rt scheduler, such as MAX_PRIO.

This patch move them all into a new header file, linux/sched/prio.h.

Signed-off-by: Dongsheng Yang yangds.f...@cn.fujitsu.com
---
 include/linux/sched.h  |  4 
 include/linux/sched/prio.h | 23 +++
 include/linux/sched/rt.h   | 21 +++--
 3 files changed, 30 insertions(+), 18 deletions(-)
 create mode 100644 include/linux/sched/prio.h

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 68a0e84..ba1b732 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -3,6 +3,10 @@
 
 #include uapi/linux/sched.h
 
+#ifndef _SCHED_PRIO_H
+#include linux/sched/prio.h
+#endif /* #ifndef _SCHED_PRIO_H */
+
 
 struct sched_param {
int sched_priority;
diff --git a/include/linux/sched/prio.h b/include/linux/sched/prio.h
new file mode 100644
index 000..9382ba8
--- /dev/null
+++ b/include/linux/sched/prio.h
@@ -0,0 +1,23 @@
+#ifndef _SCHED_PRIO_H
+#define _SCHED_PRIO_H
+
+/*
+ * Priority of a process goes from 0..MAX_PRIO-1, valid RT
+ * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
+ * tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority
+ * values are inverted: lower p-prio value means higher priority.
+ *
+ * The MAX_USER_RT_PRIO value allows the actual maximum
+ * RT priority to be separate from the value exported to
+ * user-space.  This allows kernel threads to set their
+ * priority to a value higher than any user task. Note:
+ * MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO.
+ */
+
+#define MAX_USER_RT_PRIO   100
+#define MAX_RT_PRIOMAX_USER_RT_PRIO
+
+#define MAX_PRIO   (MAX_RT_PRIO + 40)
+#define DEFAULT_PRIO   (MAX_RT_PRIO + 20)
+
+#endif /* _SCHED_PRIO_H */
diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h
index 34e4ebe..50409a3 100644
--- a/include/linux/sched/rt.h
+++ b/include/linux/sched/rt.h
@@ -1,24 +1,9 @@
 #ifndef _SCHED_RT_H
 #define _SCHED_RT_H
 
-/*
- * Priority of a process goes from 0..MAX_PRIO-1, valid RT
- * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
- * tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority
- * values are inverted: lower p-prio value means higher priority.
- *
- * The MAX_USER_RT_PRIO value allows the actual maximum
- * RT priority to be separate from the value exported to
- * user-space.  This allows kernel threads to set their
- * priority to a value higher than any user task. Note:
- * MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO.
- */
-
-#define MAX_USER_RT_PRIO   100
-#define MAX_RT_PRIOMAX_USER_RT_PRIO
-
-#define MAX_PRIO   (MAX_RT_PRIO + 40)
-#define DEFAULT_PRIO   (MAX_RT_PRIO + 20)
+#ifndef _SCHED_PRIO_H
+#include linux/sched/prio.h
+#endif /* ifndef _SCHED_PRIO_H */
 
 static inline int rt_prio(int prio)
 {
-- 
1.8.2.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/