All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Lynch <ntl@pobox.com>
To: Paul Jackson <pj@sgi.com>
Cc: dipankar@in.ibm.com, vatsa@in.ibm.com, dino@in.ibm.com,
	Simon.Derr@bull.net, lse-tech@lists.sourceforge.net,
	akpm@osdl.org, nickpiggin@yahoo.com.au,
	linux-kernel@vger.kernel.org, rusty@rustcorp.com.au
Subject: Re: [Lse-tech] Re: [PATCH] cpusets+hotplug+preepmt broken
Date: Sat, 14 May 2005 11:30:12 -0500	[thread overview]
Message-ID: <20050514163012.GL3614@otto> (raw)
In-Reply-To: <20050513195851.5d6665d0.pj@sgi.com>

On Fri, May 13, 2005 at 07:58:51PM -0700, Paul Jackson wrote:
> 
> So how would you, or Srivatsa or Nathan, respond to my more substantive
> point, to repeat:
> 
> Srivatsa, replying to Dinakar:
> > This in fact was the reason that we added lock_cpu_hotplug
> > in sched_setaffinity.
> 
> Why just in sched_setaffinity()?

I suspect that the lock_cpu_hotplug is no longer necessary in
sched_setaffinity.  I found the original changeset which introduced
it, and it's short enough that I'll just duplicate it here:

diff -Naru a/kernel/sched.c b/kernel/sched.c
--- a/kernel/sched.c	    2005-05-14 07:21:39 -07:00
+++ b/kernel/sched.c	    2005-05-14 07:21:39 -07:00
@@ -1012,6 +1012,7 @@
   unsigned long flags;
   cpumask_t old_mask, new_mask = cpumask_of_cpu(dest_cpu);
 
+	lock_cpu_hotplug();
	rq = task_rq_lock(p, &flags);
	old_mask = p->cpus_allowed;
	if (!cpu_isset(dest_cpu, old_mask) || !cpu_online(dest_cpu))
@@ -1035,6 +1036,7 @@
   }
 out:
	task_rq_unlock(rq, &flags);
+	unlock_cpu_hotplug();
 }
 
 /*
@@ -2309,11 +2311,13 @@
   if (copy_from_user(&new_mask, user_mask_ptr, sizeof(new_mask)))
      return -EFAULT;
 
+	lock_cpu_hotplug();
	read_lock(&tasklist_lock);
 
	p = find_process_by_pid(pid);
	if (!p) {
	   read_unlock(&tasklist_lock);
+		unlock_cpu_hotplug();
			return -ESRCH;
			}
 
@@ -2334,6 +2338,7 @@
 
 out_unlock:
	put_task_struct(p);
+	unlock_cpu_hotplug();
	return retval;
 }
 
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/03/19 08:02:56-08:00 rusty@rustcorp.com.au 
#   [PATCH] Hotplug CPUs: Take cpu Lock Around Migration
#   
#   Grab cpu lock around sched_migrate_task() and
#sys_sched_setaffinity().
#   This is a noop without CONFIG_HOTPLUG_CPU.
#   
#   The sched_migrate_task may have a performance penalty on NUMA if
#lots
#   of exec rebalancing is happening, however this only applies to
#   CONFIG_NUMA and CONFIG_HOTPLUG_CPU, which noone does at the moment
#   anyway.
#   
#   Also, the scheduler in -mm solves the race another way, so this
#will
#   vanish then.
# 
# kernel/sched.c
#   2004/03/16 18:10:10-08:00 rusty@rustcorp.com.au +5 -0
#   Hotplug CPUs: Take cpu Lock Around Migration
# 

The lock/unlock_cpu_hotplug is no longer there in sched_migrate_task.
The changelog leads me to believe that it was intended that the same
change should have been made to sched_setaffinity by now.  I think
it's safe to remove it; I can't see why it would be necessary any
more.

Nathan


  parent reply	other threads:[~2005-05-14 16:31 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-11 19:16 [PATCH] cpusets+hotplug+preepmt broken Dinakar Guniguntala
2005-05-11 19:25 ` [Lse-tech] " Paul Jackson
2005-05-11 19:55   ` Paul Jackson
2005-05-11 20:26     ` Nathan Lynch
2005-05-11 20:45       ` Paul Jackson
2005-05-11 19:51 ` Nathan Lynch
2005-05-11 20:42   ` Paul Jackson
2005-05-11 20:58     ` Paul Jackson
2005-05-14  2:23       ` Paul Jackson
2005-05-14 12:14         ` Nathan Lynch
2005-05-14 17:04           ` Paul Jackson
2005-05-14 17:44             ` Paul Jackson
2005-05-18  4:14               ` Paul Jackson
2005-05-18  9:29               ` [Lse-tech] " Dinakar Guniguntala
2005-05-18 14:48               ` Nathan Lynch
2005-05-18 21:16               ` Paul Jackson
2005-05-14 16:28         ` Srivatsa Vaddagiri
2005-05-12 15:10     ` Dinakar Guniguntala
2005-05-13 12:15       ` [Lse-tech] " Dinakar Guniguntala
2005-05-13  0:34     ` Nathan Lynch
2005-05-13 12:32   ` [Lse-tech] " Dinakar Guniguntala
2005-05-13 17:25     ` Srivatsa Vaddagiri
2005-05-13 19:59       ` Paul Jackson
2005-05-13 20:20         ` Dipankar Sarma
2005-05-13 20:46           ` Nathan Lynch
2005-05-13 21:05             ` Paul Jackson
2005-05-13 21:06             ` Dipankar Sarma
2005-05-13 20:52           ` Paul Jackson
2005-05-13 21:02             ` Dipankar Sarma
2005-05-14  2:58               ` Paul Jackson
2005-05-14 16:09                 ` Srivatsa Vaddagiri
2005-05-14 17:50                   ` Paul Jackson
2005-05-14 17:57                   ` Paul Jackson
2005-05-14 16:30                 ` Nathan Lynch [this message]
2005-05-14 17:23                   ` Srivatsa Vaddagiri
2005-05-14 23:17                     ` Nathan Lynch
2005-05-13 19:59     ` Paul Jackson
2005-05-13 21:27     ` Nathan Lynch

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=20050514163012.GL3614@otto \
    --to=ntl@pobox.com \
    --cc=Simon.Derr@bull.net \
    --cc=akpm@osdl.org \
    --cc=dino@in.ibm.com \
    --cc=dipankar@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lse-tech@lists.sourceforge.net \
    --cc=nickpiggin@yahoo.com.au \
    --cc=pj@sgi.com \
    --cc=rusty@rustcorp.com.au \
    --cc=vatsa@in.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.