From owner-svn-src-stable-10@freebsd.org Mon Jan 23 16:04:51 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75EDACBE5E6; Mon, 23 Jan 2017 16:04:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 2F16E3BC; Mon, 23 Jan 2017 16:04:49 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id SAA20869; Mon, 23 Jan 2017 18:04:47 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1cVh6t-0007iT-0P; Mon, 23 Jan 2017 18:04:47 +0200 Subject: Re: svn commit: r312666 - stable/10/sys/kern To: Bruce Evans References: <201701230834.v0N8Ypnu011042@repo.freebsd.org> <20170124002712.Q903@besplex.bde.org> Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-stable@FreeBSD.org, svn-src-stable-10@FreeBSD.org From: Andriy Gapon Message-ID: <49838a2b-c628-da8c-4c9c-4a66c83119f8@FreeBSD.org> Date: Mon, 23 Jan 2017 18:03:45 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <20170124002712.Q903@besplex.bde.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jan 2017 16:04:51 -0000 On 23/01/2017 15:34, Bruce Evans wrote: > On Mon, 23 Jan 2017, Andriy Gapon wrote: > >> ============================================================================== >> --- stable/10/sys/kern/sched_4bsd.c Mon Jan 23 08:34:41 2017 (r312665) >> +++ stable/10/sys/kern/sched_4bsd.c Mon Jan 23 08:34:51 2017 (r312666) >> @@ -963,8 +963,8 @@ sched_switch(struct thread *td, struct t >> sched_load_rem(); >> >> td->td_lastcpu = td->td_oncpu; >> - preempted = !((td->td_flags & TDF_SLICEEND) || >> - (flags & SWT_RELINQUISH)); >> + preempted = (td->td_flags & TDF_SLICEEND) == 0 && >> + (flags & SW_PREEMPT) != 0; >> td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND); >> td->td_owepreempt = 0; >> td->td_oncpu = NOCPU; > > Please also merge to FreeBSD-9. FreeBSD-9 has best performance for a > makeworld benchmark. Will do. > What is a good benchmark for showing that the fix helps? Honestly, I do not know. We ran into a pathology where a thread was not getting scheduled for a long time after being preempted while in a critical section (so the actual preemption was a voluntary switch when exiting the critical section). I am not sure what kind of a synthetic benchmark or a test case would readily demonstrate the problem. > Involuntary context switches increased by almost a factor of 2 for the > makeworld benchmark (over nfs) recently, but that was just caused by > pessimizations in the NIC driver. -- Andriy Gapon