mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org
Subject: Re: + schedule_on_each_cpu-use-preempt_disable.patch added to -mm tree
Date: Fri, 15 Dec 2006 11:27:48 -0800	[thread overview]
Message-ID: <20061215112748.5dbcf7ca.akpm@osdl.org> (raw)
In-Reply-To: <20061215162416.GB29191@elte.hu>

On Fri, 15 Dec 2006 17:24:16 +0100
Ingo Molnar <mingo@elte.hu> wrote:

> 
> * Andrew Morton <akpm@osdl.org> wrote:
> 
> > > >  	for_each_online_cpu(cpu) {
> > > >  		INIT_WORK(per_cpu_ptr(works, cpu), func);
> > > >  		__queue_work(per_cpu_ptr(keventd_wq->cpu_wq, cpu),
> > > >  				per_cpu_ptr(works, cpu));
> > > >  	}
> > > > -	mutex_unlock(&workqueue_mutex);
> > > > +	preempt_enable();
> > > 
> > > Why not cpu_hotplug_lock()?
> > > 
> > 
> > Because the workqueue code was explicitly switched over to 
> > per-subsystem cpu-hotplug locking.
> > 
> > Because lock_cpu_hotplug() is a complete turkey, source of deadlocks 
> > and overall bad idea.
> 
> not in the locking model i outlined earlier, which would turn it into a 
> read-lock in essence.
> 
> > This is actually a pretty simple problem.  A subsystem has per-cpu 
> > reosurces, and it needs to lock them while using them.  duh.  We know 
> > how to do that sort of thing.  But because the first implementation of 
> > lock_cpu_hotplug() was conceived with magical properties, we seem to 
> > think we need to retain magical properties.  We don't...
> 
> actually, we use two things here: cpu_online_map and the per-cpu keventd 
> workqueues. cpu_online_map is pretty much attached to the CPU hotplug 
> subsystem so it would be quite natural to use cpu_hotplug_read_lock() 
> for that.

The two are connected, because cpu add/remove creates and kills keventd
threads.

> so i disagree that CPU hotplug locking should be per-subsystem. We 
> should have one lightweight and scalable primitive that protects 
> cpu_online_map use, and that same primitive can be used to protect other 
> per-CPU resources too.

This problem can be (is being) solved using existing locking primitives.


  reply	other threads:[~2006-12-15 19:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200612150823.kBF8NV2u011171@shell0.pdx.osdl.net>
2006-12-15  8:31 ` Ingo Molnar
2006-12-15 16:11   ` Andrew Morton
2006-12-15 16:24     ` Ingo Molnar
2006-12-15 19:27       ` Andrew Morton [this message]
2006-12-15 17:51     ` [PATCH] struct vfsmount : keep mnt_count & mnt_expiry_mark away from mnt_flags Eric Dumazet
2006-12-15 18:38       ` [PATCH] avoid one conditional branch in touch_atime() Eric Dumazet

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=20061215112748.5dbcf7ca.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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

all inboxes | Powered by JetHome®