OpenVZ Forum


Home » Mailing lists » Devel » [PATCH -mm] task_struct: move ->fpu_counter and ->oomkilladj
[PATCH -mm] task_struct: move ->fpu_counter and ->oomkilladj [message #20879] Thu, 27 September 2007 09:55 Go to next message
Alexey Dobriyan is currently offline  Alexey Dobriyan
Messages: 195
Registered: August 2006
Senior Member
There is nice 2 byte hole after struct task_struct::ioprio field
into which we can put two 1-byte fields: ->fpu_counter and ->oomkilladj.

[cc'ing Arjan just in case ->fpu_counter placement wasn't completely random :^)]

Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru>
---

 include/linux/sched.h |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -960,6 +960,16 @@ struct task_struct {
 #endif
 
 	unsigned short ioprio;
+	/*
+	 * fpu_counter contains the number of consecutive context switches
+	 * that the FPU is used. If this is over a threshold, the lazy fpu
+	 * saving becomes unlazy to save the trap. This is an unsigned char
+	 * so that after 256 times the counter wraps and the behavior turns
+	 * lazy again; this to deal with bursty apps that only use FPU for
+	 * a short time
+	 */
+	unsigned char fpu_counter;
+	s8 oomkilladj; /* OOM kill score adjustment (bit shift). */
 #ifdef CONFIG_BLK_DEV_IO_TRACE
 	unsigned int btrace_seq;
 #endif
@@ -1044,16 +1054,6 @@ struct task_struct {
 	struct key *thread_keyring;	/* keyring private to this thread */
 	unsigned char jit_keyring;	/* default keyring to attach requested keys to */
 #endif
-	/*
-	 * fpu_counter contains the number of consecutive context switches
-	 * that the FPU is used. If this is over a threshold, the lazy fpu
-	 * saving becomes unlazy to save the trap. This is an unsigned char
-	 * so that after 256 times the counter wraps and the behavior turns
-	 * lazy again; this to deal with bursty apps that only use FPU for
-	 * a short time
-	 */
-	unsigned char fpu_counter;
-	s8 oomkilladj; /* OOM kill score adjustment (bit shift). */
 	char comm[TASK_COMM_LEN]; /* executable name excluding path
 				     - access with [gs]et_task_comm (which lock
 				       it with task_lock())
Re: [PATCH -mm] task_struct: move ->fpu_counter and ->oomkilladj [message #20899 is a reply to message #20879] Thu, 27 September 2007 13:56 Go to previous message
Arjan van de Ven is currently offline  Arjan van de Ven
Messages: 14
Registered: March 2006
Junior Member
On Thu, 27 Sep 2007 13:55:57 +0400
Alexey Dobriyan <adobriyan@sw.ru> wrote:

> There is nice 2 byte hole after struct task_struct::ioprio field
> into which we can put two 1-byte fields: ->fpu_counter and
> ->oomkilladj.
> 
> [cc'ing Arjan just in case ->fpu_counter placement wasn't completely
> random :^)]


fpu_counter was more or less random, but it does get written to
frequently (making the cacheline dirty)
Previous Topic: [patch 0/3][netns] several fixes/enhancements
Next Topic: [RFC][PATCH] Devices visibility container
Goto Forum:
  


Current Time: Mon Aug 04 10:25:36 GMT 2025

Total time taken to generate the page: 1.63769 seconds