Re: [PATCH] netpoll: Fix carrier detection for drivers that areusing phylib

From: Matt Mackall
Date: Thu Jul 09 2009 - 10:46:19 EST


On Thu, 2009-07-09 at 16:31 +0200, Peter Zijlstra wrote:
> On Thu, 2009-07-09 at 09:18 -0500, Matt Mackall wrote:
> >
> > Sorry if I was unclear. I'm suggesting setting the count so the existing
> > PREEMPT_ACTIVE test here fires:
> >
> > int __sched _cond_resched(void)
> > {
> > if (need_resched() && !(preempt_count() & PREEMPT_ACTIVE) &&
> > system_state == SYSTEM_RUNNING) {
> > __cond_resched();
> > return 1;
> > }
> > return 0;
> > }
>
> Right, /me read preempt and thought a simple preempt inc but didn't read
> the code. Shame on me.
>
> So something like (utterly untested and such)

Yeah, that's what I had in mind. Probably throw in a define:

/* for disabling scheduling in early boot */
#define PREEMPT_EARLY (1 + PREEMPT_ACTIVE)

and slap a comment on the sub_preempt_count().

Does anything actually use scheduler_running yet? Perhaps my tree is
old.

Also, might_sleep's use of system_state probably bears revisiting.

--
http://selenic.com : development and support for Mercurial and Linux


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/