public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>, Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [patch 1/3] Drop tasklist lock in do_sched_setscheduler
Date: Sun, 25 Jun 2006 04:50:45 +0400	[thread overview]
Message-ID: <20060625005045.GA155@oleg> (raw)

Thomas Gleixner wrote:
>
> There is no need to hold tasklist_lock across the setscheduler call, when we
> pin the task structure with get_task_struct(). Interrupts are disabled in 
> setscheduler anyway and the permission checks do not need interrupts disabled.
>
> --- linux-2.6.17-mm.orig/kernel/sched.c	2006-06-22 10:26:11.000000000 +0200
> +++ linux-2.6.17-mm/kernel/sched.c	2006-06-22 10:26:11.000000000 +0200
> @@ -4140,8 +4140,10 @@
>  		read_unlock_irq(&tasklist_lock);
>  		return -ESRCH;
>  	}
> -	retval = sched_setscheduler(p, policy, &lparam);
> +	get_task_struct(p);
>  	read_unlock_irq(&tasklist_lock);
> +	retval = sched_setscheduler(p, policy, &lparam);
> +	put_task_struct(p);
>  	return retval;
>  }

But we don't need read_lock(tasklist) and get_task_struct(p) at all?

rcu_read_lock/rcu_read_unlock is enough, no?

Oleg.


             reply	other threads:[~2006-06-24 20:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-25  0:50 Oleg Nesterov [this message]
2006-06-25 15:35 ` [patch 1/3] Drop tasklist lock in do_sched_setscheduler Thomas Gleixner
  -- strict thread matches above, loose matches on Subject: below --
2006-06-22  9:08 [patch 0/3] rtmutex: Propagate priority setting into lock chains Thomas Gleixner
2006-06-22  9:08 ` [patch 1/3] Drop tasklist lock in do_sched_setscheduler Thomas Gleixner
2006-06-23  1:48   ` Andrew Morton
2006-06-23  6:01     ` Thomas Gleixner
2006-06-24  8:07   ` Andrew Morton
2006-06-24  8:25     ` Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060625005045.GA155@oleg \
    --to=oleg@tv-sign.ru \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox