task_struct cleanup: move binfmt field to mm_struct

Because the binfmt is not different between threads in the same process,
it can be moved from task_struct to mm_struct.  And binfmt moudle is
handled per mm_struct instead of task_struct.

Signed-off-by: Hiroshi Shimamoto <[email protected]>
Acked-by: Oleg Nesterov <[email protected]>
Cc: Rusty Russell <[email protected]>
Acked-by: Roland McGrath <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Hiroshi Shimamoto 2009-09-23 15:57:41 -07:00 • committed by Linus Torvalds
commit 801460d0cf
5 changed files with 15 additions and 13 deletions

View file

@ -1397,10 +1397,12 @@ out_ret:
void set_binfmt(struct linux_binfmt *new)
{
if (current->binfmt)
module_put(current->binfmt->module);
struct mm_struct *mm = current->mm;
current->binfmt = new;
if (mm->binfmt)
module_put(mm->binfmt->module);
mm->binfmt = new;
if (new)
__module_get(new->module);
}
@ -1770,7 +1772,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
audit_core_dumps(signr);
binfmt = current->binfmt;
binfmt = mm->binfmt;
if (!binfmt || !binfmt->core_dump)
goto fail;