Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 33756
b: refs/heads/master
c: 35df17c
h: refs/heads/master
v: v3
  • Loading branch information
Shailabh Nagar authored and Linus Torvalds committed Sep 1, 2006
1 parent 2b63c35 commit 491442e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 30f3174d1c506db2c6d2c1dddc9c064e741d6b76
refs/heads/master: 35df17c57cecb08f0120fb18926325f1093dc429
10 changes: 7 additions & 3 deletions trunk/include/linux/delayacct.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,14 @@ static inline void delayacct_tsk_init(struct task_struct *tsk)
__delayacct_tsk_init(tsk);
}

static inline void delayacct_tsk_exit(struct task_struct *tsk)
/* Free tsk->delays. Called from bad fork and __put_task_struct
* where there's no risk of tsk->delays being accessed elsewhere
*/
static inline void delayacct_tsk_free(struct task_struct *tsk)
{
if (tsk->delays)
__delayacct_tsk_exit(tsk);
kmem_cache_free(delayacct_cache, tsk->delays);
tsk->delays = NULL;
}

static inline void delayacct_blkio_start(void)
Expand Down Expand Up @@ -101,7 +105,7 @@ static inline void delayacct_init(void)
{}
static inline void delayacct_tsk_init(struct task_struct *tsk)
{}
static inline void delayacct_tsk_exit(struct task_struct *tsk)
static inline void delayacct_tsk_free(struct task_struct *tsk)
{}
static inline void delayacct_blkio_start(void)
{}
Expand Down
1 change: 0 additions & 1 deletion trunk/include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,6 @@ struct task_struct {
*/
struct pipe_inode_info *splice_pipe;
#ifdef CONFIG_TASK_DELAY_ACCT
spinlock_t delays_lock;
struct task_delay_info *delays;
#endif
};
Expand Down
16 changes: 0 additions & 16 deletions trunk/kernel/delayacct.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,11 @@ void delayacct_init(void)

void __delayacct_tsk_init(struct task_struct *tsk)
{
spin_lock_init(&tsk->delays_lock);
/* No need to acquire tsk->delays_lock for allocation here unless
__delayacct_tsk_init called after tsk is attached to tasklist
*/
tsk->delays = kmem_cache_zalloc(delayacct_cache, SLAB_KERNEL);
if (tsk->delays)
spin_lock_init(&tsk->delays->lock);
}

void __delayacct_tsk_exit(struct task_struct *tsk)
{
struct task_delay_info *delays = tsk->delays;
spin_lock(&tsk->delays_lock);
tsk->delays = NULL;
spin_unlock(&tsk->delays_lock);
kmem_cache_free(delayacct_cache, delays);
}

/*
* Start accounting for a delay statistic using
* its starting timestamp (@start)
Expand Down Expand Up @@ -118,8 +105,6 @@ int __delayacct_add_tsk(struct taskstats *d, struct task_struct *tsk)
struct timespec ts;
unsigned long t1,t2,t3;

spin_lock(&tsk->delays_lock);

/* Though tsk->delays accessed later, early exit avoids
* unnecessary returning of other data
*/
Expand Down Expand Up @@ -161,7 +146,6 @@ int __delayacct_add_tsk(struct taskstats *d, struct task_struct *tsk)
spin_unlock(&tsk->delays->lock);

done:
spin_unlock(&tsk->delays_lock);
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion trunk/kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,6 @@ fastcall NORET_TYPE void do_exit(long code)
audit_free(tsk);
taskstats_exit_send(tsk, tidstats, group_dead, mycpu);
taskstats_exit_free(tidstats);
delayacct_tsk_exit(tsk);

exit_mm(tsk);

Expand Down
6 changes: 4 additions & 2 deletions trunk/kernel/fork.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ void __put_task_struct(struct task_struct *tsk)
security_task_free(tsk);
free_uid(tsk->user);
put_group_info(tsk->group_info);
delayacct_tsk_free(tsk);

if (!profile_handoff_task(tsk))
free_task(tsk);
Expand Down Expand Up @@ -1011,7 +1012,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
retval = -EFAULT;
if (clone_flags & CLONE_PARENT_SETTID)
if (put_user(p->pid, parent_tidptr))
goto bad_fork_cleanup;
goto bad_fork_cleanup_delays_binfmt;

INIT_LIST_HEAD(&p->children);
INIT_LIST_HEAD(&p->sibling);
Expand Down Expand Up @@ -1277,7 +1278,8 @@ static struct task_struct *copy_process(unsigned long clone_flags,
bad_fork_cleanup_cpuset:
#endif
cpuset_exit(p);
bad_fork_cleanup:
bad_fork_cleanup_delays_binfmt:
delayacct_tsk_free(p);
if (p->binfmt)
module_put(p->binfmt->module);
bad_fork_cleanup_put_domain:
Expand Down

0 comments on commit 491442e

Please sign in to comment.