[ 14/34] frv: Use correct size for task_struct allocation

From: Greg Kroah-Hartman
Date: Sun Aug 18 2013 - 16:53:40 EST


3.4-stable review patch. If anyone has any objections, please let me know.

------------------

From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>

commit cce4517f33384c3794c759e206cc8e1bb6df146b upstream.

alloc_task_struct_node() allocates THREAD_SIZE and maintains some
weird refcount in the allocated memory. This never blew up as
task_struct size on 32bit machines was always less than THREAD_SIZE

Allocate just sizeof(struct task_struct) and get rid of the magic
refcounting.

Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Acked-by: David Howells <dhowells@xxxxxxxxxx>
Link: http://lkml.kernel.org/r/20120503085033.898475542@xxxxxxxxxxxxx
Cc: Guenter Roeck <linux@xxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
arch/frv/kernel/process.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)

--- a/arch/frv/kernel/process.c
+++ b/arch/frv/kernel/process.c
@@ -46,17 +46,12 @@ EXPORT_SYMBOL(pm_power_off);

struct task_struct *alloc_task_struct_node(int node)
{
- struct task_struct *p = kmalloc_node(THREAD_SIZE, GFP_KERNEL, node);
-
- if (p)
- atomic_set((atomic_t *)(p+1), 1);
- return p;
+ return kmalloc_node(sizeof(task_struct), GFP_KERNEL, node);
}

void free_task_struct(struct task_struct *p)
{
- if (atomic_dec_and_test((atomic_t *)(p+1)))
- kfree(p);
+ kfree(p);
}

static void core_sleep_idle(void)


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