Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 302836
b: refs/heads/master
c: 0d15d74
h: refs/heads/master
v: v3
  • Loading branch information
Thomas Gleixner committed May 8, 2012
1 parent cf4304b commit 32ba76f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 67ba5293f705eb1d1b98710e5ccb0f615936a6fc
refs/heads/master: 0d15d74a1ead10673b5b1db66d4c90552769096c
27 changes: 27 additions & 0 deletions trunk/kernel/fork.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ static inline void free_task_struct(struct task_struct *tsk)

void __weak arch_release_thread_info(struct thread_info *ti) { }

/*
* Allocate pages if THREAD_SIZE is >= PAGE_SIZE, otherwise use a
* kmemcache based allocator.
*/
# if THREAD_SIZE >= PAGE_SIZE
static struct thread_info *alloc_thread_info_node(struct task_struct *tsk,
int node)
{
Expand All @@ -146,6 +151,28 @@ static inline void free_thread_info(struct thread_info *ti)
arch_release_thread_info(ti);
free_pages((unsigned long)ti, THREAD_SIZE_ORDER);
}
# else
static struct kmem_cache *thread_info_cache;

static struct thread_info *alloc_thread_info_node(struct task_struct *tsk,
int node)
{
return kmem_cache_alloc_node(thread_info_cache, THREADINFO_GFP, node);
}

static void free_thread_info(struct thread_info *ti)
{
arch_release_thread_info(ti);
kmem_cache_free(thread_info_cache, ti);
}

void thread_info_cache_init(void)
{
thread_info_cache = kmem_cache_create("thread_info", THREAD_SIZE,
THREAD_SIZE, 0, NULL);
BUG_ON(thread_info_cache == NULL);
}
# endif
#endif

/* SLAB cache for signal_struct structures (tsk->signal) */
Expand Down

0 comments on commit 32ba76f

Please sign in to comment.