2.4.23 *_task_struct() observations ...

From: Herbert Poetzl
Date: Mon Dec 01 2003 - 12:27:10 EST



Hi All!

just wanted to get an opinion on the following ...

include/asm-i386/processor.h defines ...

#define alloc_task_struct() ((struct task_struct *) \
__get_free_pages(GFP_KERNEL,1))
#define free_task_struct(p) free_pages((unsigned long) (p), 1)
#define get_task_struct(tsk) atomic_inc(&virt_to_page(tsk)->count)

now there seems to be no put_task_struct(), but
there are some examples where get/free is used
where I would expect a put_* ...

fs/proc/base.c for example does:

read_lock(&tasklist_lock);
task = find_task_by_pid(pid);
if (task)
get_task_struct(task);
read_unlock(&tasklist_lock);
if (!task)
goto out;

inode = proc_pid_make_inode(dir->i_sb, task, PROC_PID_INO);

free_task_struct(task);

which is a little suspicious ...

please could anybody explain the logic behind that?
(if it isn't a widespread bug(tm))

TIA,
Herbert


-
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/