From owner-freebsd-arch@FreeBSD.ORG Wed Feb 19 22:55:04 2014 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7ACA39D5; Wed, 19 Feb 2014 22:55:04 +0000 (UTC) Received: from mail-qa0-x22d.google.com (mail-qa0-x22d.google.com [IPv6:2607:f8b0:400d:c00::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 108DB1D33; Wed, 19 Feb 2014 22:55:03 +0000 (UTC) Received: by mail-qa0-f45.google.com with SMTP id m5so1733696qaj.4 for ; Wed, 19 Feb 2014 14:55:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=FzkE4mtRngfT55+6aMNHO5UuDsMi7jpIukJp2bb7x9U=; b=NfkaCwM8t//W5gcYCbjD6MZZXn5Y3Xb0Ul8YYIjkGTW7lArjwmUssEvApO7DcdFhxv DTfa51gQTNYD7fPmUdqnBeIRZjPVm7V5FEaaQVTWXOKW2PtCyj/lDyOJ3SmXLCSQsYE2 nzvwqGJpFY52cJhWchShmIGfw0qln/2LPeU3vi3iziqh4KKHVTSCsalN4nyDhqQG+b4p foSWxNmWPZZiGZc3Y9QRxDmbsorlS2oXeLpjNn0KF17FTUlQEhN+H/79xurqnujfOuvX vw1AxOd7f+wk+ATcVMwOXC/u5IL/9OiKOcswr4NcQ8epd2s0mEeYwOqxab+lESp2nFtA +/YA== MIME-Version: 1.0 X-Received: by 10.224.160.195 with SMTP id o3mr5218609qax.98.1392850503157; Wed, 19 Feb 2014 14:55:03 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.224.16.10 with HTTP; Wed, 19 Feb 2014 14:55:03 -0800 (PST) In-Reply-To: <53052B80.3010505@FreeBSD.org> References: <530508B7.7060102@FreeBSD.org> <53050D24.3020505@FreeBSD.org> <53051C71.3050705@FreeBSD.org> <20140219214428.GA53864@zxy.spb.ru> <53052B80.3010505@FreeBSD.org> Date: Wed, 19 Feb 2014 14:55:03 -0800 X-Google-Sender-Auth: PTeu-O3MZj0oEYNAg5JUlt3SFkQ Message-ID: Subject: Re: [rfc] bind per-cpu timeout threads to each CPU From: Adrian Chadd To: Alexander Motin Content-Type: text/plain; charset=ISO-8859-1 Cc: "freebsd-arch@freebsd.org" , freebsd-current , Slawa Olhovchenkov X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Feb 2014 22:55:04 -0000 On 19 February 2014 14:09, Alexander Motin wrote: > On 19.02.2014 23:44, Slawa Olhovchenkov wrote: >> >> On Wed, Feb 19, 2014 at 11:04:49PM +0200, Alexander Motin wrote: >> >>> On 19.02.2014 22:04, Adrian Chadd wrote: >>>> >>>> On 19 February 2014 11:59, Alexander Motin wrote: >>>> >>>>>> So if we're moving towards supporting (among others) a pcbgroup / RSS >>>>>> hash style work load distribution across CPUs to minimise >>>>>> per-connection lock contention, we really don't want the scheduler to >>>>>> decide it can schedule things on other CPUs under enough pressure. >>>>>> That'll just make things worse. >>>> >>>> >>>>> True, though it is also not obvious that putting second thread on CPU >>>>> run >>>>> queue is better then executing it right now on another core. >>>> >>>> >>>> Well, it depends if you're trying to optimise for "run all runnable >>>> tasks as quickly as possible" or "run all runnable tasks in contexts >>>> that minimise lock contention." >>>> >>>> The former sounds great as long as there's no real lock contention >>>> going on. But as you add more chances for contention (something like >>>> "100,000 concurrent TCP flows") then you may end up having your TCP >>>> timer firing stuff interfere with more TXing or RXing on the same >>>> connection. >>> >>> >>> 100K TCP flows probably means 100K locks. That means that chance of lock >>> collision on each of them is effectively zero. More realistic it could >> >> >> What about 100K/N_cpu*PPS timer's queue locks for remove/insert TCP >> timeouts callbacks? > > > I am not sure what this formula means, but yes, per-CPU callout locks can > much more likely be congested. They are only per-CPU, not per-flow. It's not just that, but also TX versus RX ACK processing and further TX being done on different threads. -a