From patchwork Thu Jul 9 14:31:02 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 29629 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 955E5B707D for ; Fri, 10 Jul 2009 00:31:42 +1000 (EST) Received: by ozlabs.org (Postfix) id 84B26DDDF4; Fri, 10 Jul 2009 00:31:42 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 1D211DDD0B for ; Fri, 10 Jul 2009 00:31:42 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761119AbZGIObN (ORCPT ); Thu, 9 Jul 2009 10:31:13 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760999AbZGIObM (ORCPT ); Thu, 9 Jul 2009 10:31:12 -0400 Received: from viefep14-int.chello.at ([62.179.121.34]:46402 "EHLO viefep14-int.chello.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760737AbZGIObL (ORCPT ); Thu, 9 Jul 2009 10:31:11 -0400 Received: from edge04.upc.biz ([192.168.13.239]) by viefep14-int.chello.at (InterMail vM.7.09.01.00 201-2219-108-20080618) with ESMTP id <20090709143107.NBYQ18330.viefep14-int.chello.at@edge04.upc.biz>; Thu, 9 Jul 2009 16:31:07 +0200 Received: from [192.168.0.111] ([213.93.53.227]) by edge04.upc.biz with edge id DqX21c0974u7oB104qX3pJ; Thu, 09 Jul 2009 16:31:07 +0200 X-SourceIP: 213.93.53.227 Subject: Re: [PATCH] netpoll: Fix carrier detection for drivers that are using phylib From: Peter Zijlstra To: Matt Mackall Cc: Linus Torvalds , Anton Vorontsov , Andrew Morton , oleg@redhat.com, mingo@elte.hu, linux-kernel@vger.kernel.org, netdev@vger.kernel.org In-Reply-To: <1247149093.21295.915.camel@calx> References: <20090707235812.GA12824@oksana.dev.rtsoft.ru> <20090708005000.GA12380@redhat.com> <1247034263.9777.24.camel@twins> <20090708141024.f8b581c5.akpm@linux-foundation.org> <20090708213331.GA9346@oksana.dev.rtsoft.ru> <20090708144744.5555b88d.akpm@linux-foundation.org> <20090708222003.GA12318@oksana.dev.rtsoft.ru> <1247145977.21295.899.camel@calx> <1247147206.7439.2.camel@twins> <1247149093.21295.915.camel@calx> Date: Thu, 09 Jul 2009 16:31:02 +0200 Message-Id: <1247149862.12784.6.camel@twins> Mime-Version: 1.0 X-Mailer: Evolution 2.26.1 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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) --- arch/x86/include/asm/thread_info.h | 2 +- kernel/sched.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h index b078352..7b5dbce 100644 --- a/arch/x86/include/asm/thread_info.h +++ b/arch/x86/include/asm/thread_info.h @@ -49,7 +49,7 @@ struct thread_info { .exec_domain = &default_exec_domain, \ .flags = 0, \ .cpu = 0, \ - .preempt_count = 1, \ + .preempt_count = 1 + PREEMPT_ACTIVE, \ .addr_limit = KERNEL_DS, \ .restart_block = { \ .fn = do_no_restart_syscall, \ diff --git a/kernel/sched.c b/kernel/sched.c index fd3ac58..8e81162 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -6599,8 +6599,7 @@ static void __cond_resched(void) int __sched _cond_resched(void) { - if (need_resched() && !(preempt_count() & PREEMPT_ACTIVE) && - system_state == SYSTEM_RUNNING) { + if (need_resched() && !(preempt_count() & PREEMPT_ACTIVE)) { __cond_resched(); return 1; } @@ -9422,6 +9421,7 @@ void __init sched_init(void) perf_counter_init(); scheduler_running = 1; + sub_preempt_count(PREEMPT_ACTIVE); } #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP