mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-23 07:01:23 +00:00
[PATCH] taskstats: cleanup ->signal->stats allocation
Allocate ->signal->stats on demand in taskstats_exit(), this allows us to remove taskstats_tgid_alloc() (the last non-trivial inline) from taskstat's public interface. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Cc: Balbir Singh <balbir@in.ibm.com> Cc: Shailabh Nagar <nagar@watson.ibm.com> Cc: Jay Lan <jlan@engr.sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
115085ea07
commit
34ec12349c
3 changed files with 25 additions and 26 deletions
|
@ -20,28 +20,6 @@ static inline void taskstats_tgid_init(struct signal_struct *sig)
|
|||
sig->stats = NULL;
|
||||
}
|
||||
|
||||
static inline void taskstats_tgid_alloc(struct task_struct *tsk)
|
||||
{
|
||||
struct signal_struct *sig = tsk->signal;
|
||||
struct taskstats *stats;
|
||||
|
||||
if (sig->stats != NULL)
|
||||
return;
|
||||
|
||||
/* No problem if kmem_cache_zalloc() fails */
|
||||
stats = kmem_cache_zalloc(taskstats_cache, GFP_KERNEL);
|
||||
|
||||
spin_lock_irq(&tsk->sighand->siglock);
|
||||
if (!sig->stats) {
|
||||
sig->stats = stats;
|
||||
stats = NULL;
|
||||
}
|
||||
spin_unlock_irq(&tsk->sighand->siglock);
|
||||
|
||||
if (stats)
|
||||
kmem_cache_free(taskstats_cache, stats);
|
||||
}
|
||||
|
||||
static inline void taskstats_tgid_free(struct signal_struct *sig)
|
||||
{
|
||||
if (sig->stats)
|
||||
|
@ -55,8 +33,6 @@ static inline void taskstats_exit(struct task_struct *tsk, int group_dead)
|
|||
{}
|
||||
static inline void taskstats_tgid_init(struct signal_struct *sig)
|
||||
{}
|
||||
static inline void taskstats_tgid_alloc(struct task_struct *tsk)
|
||||
{}
|
||||
static inline void taskstats_tgid_free(struct signal_struct *sig)
|
||||
{}
|
||||
static inline void taskstats_init_early(void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue