lkml.org 
[lkml]   [2013]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Percpu tag allocator
On Thu, 13 Jun 2013 12:06:10 -0700 Tejun Heo <tj@kernel.org> wrote:

> Hello, Andrew, Kent.
>
> On Wed, Jun 12, 2013 at 04:38:54PM -0700, Andrew Morton wrote:
> ...
> > > +unsigned percpu_tag_alloc(struct percpu_tag_pool *pool, gfp_t gfp)
> > > +{
> > > + DEFINE_WAIT(wait);
> > > + struct percpu_tag_cpu_freelist *tags;
> > > + unsigned long flags;
> > > + unsigned tag, this_cpu;
> > > +
> > > + while (1) {
> > > + local_irq_save(flags);
> ...
> > > + schedule();
> > > + }
> >
> > Does this loop need a try_to_freeze()?
>
> I don't think so. Kernel tasks should never enter freezer without it
> explicitly knowing it. It should be something evident in the
> top-level control flow. Freezer acts as a giant lock and entering
> freezer deep underneath where the task could be holding random number
> of resources and locks can easily develop into a deadlock.

As I understand it, if a task is stuck in this loop at freeze time, the
whole freeze attempt will fail. But it's been a long time since I
thought about or worked on this stuff.

Another issue is device takedown ordering - this thread is blocked
waiting for tags to be returned by IO completion, so there may be
issues where the hardware has been shut down.

I really don't know - I'm flagging it as something which should be
thought about, tested, etc.

> If this allocation wait is gonna be visible to userland, what's
> necessary probably would be making the sleeping interruptible. The
> freezer will then make the alloc fail and control should return to the
> signal delivery path where it'll be frozen without holding any
> resources.

Maybe. Interruptible sleeps here will be a bit of a nuisance with
signals. Poke Rafael ;)



\
 
 \ /
  Last update: 2013-06-13 21:21    [W:0.445 / U:0.492 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site