From owner-freebsd-current@freebsd.org Mon Aug 1 16:55:27 2016 Return-Path: Delivered-To: freebsd-current@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 71FE6BAAF8B for ; Mon, 1 Aug 2016 16:55:27 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com [IPv6:2a00:1450:400c:c09::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1247719BB; Mon, 1 Aug 2016 16:55:27 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm0-x229.google.com with SMTP id f65so377763785wmi.0; Mon, 01 Aug 2016 09:55:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=22KdzTdkkVCMmg0TyV/SqawbdKmJSg3B4RuK3H41kVA=; b=gkvi5jKJAERfSLQkGHIEP676qa8qwJVTzc2D5x7uS3AFiTCS5yMhV3U+OpD934Oo2W vOPqTTWHXDYhxmNpPiREPZHqzSH4lIbjHxvSU7lDqbtXXoSHA79oAjMpuwjTH5ZIdVDr EHVBi0AdpmQrtLFBYuQ0/QJWZI6L4jxD8a++iFrRVacqoMRxGXdooqRwWjxj4FGxlixd SwSxBDlabR67RjsfpCl7+/e18jiNizGGWkeJUZgw3sJtoBCrsVIOz5sazaRNZCpn4p1N cpBYzXq8zxZfm2WNpj7x42s2zh5Z/LsMpLqtweEny21kdmosCHy8ZFA7HHCI1Cqq8GKY otZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=22KdzTdkkVCMmg0TyV/SqawbdKmJSg3B4RuK3H41kVA=; b=W2pKq+Sml6CYUB2rVzY/whpoEzINYgsn7nfeNUywiBJsjsEZ79YCk3NylZBFMAhmVl IqbYHnCM/14gt+Fqmnjuc2rSFFlO8aknS1WkNJYjfgOQSCliKL2RmmdFCHGvsY7Xi1ts KZRtQPTnpiIua2XbXbGMEVxZD8ZmrLaJ81RG+FVZvSOl3XVasuEsTbO7+UpuHp8lSQJo 4ocAUmz82rH9T+ieVpjndRCfy470oeW/qq39UDOtyWRPi1d2GUUyS1OIlxQrBoatQnJ4 Lxbd/k9o8Gkn7dvg4oOOZogrJBHCTCG/2ox65802SEwapBIocn6kCPCTWPa65GMnHhrl JUXg== X-Gm-Message-State: AEkoouvOQrFjG6oIclfy0aUhtLGy9qFudT6nAUX9dBEJrW9o96B1BXKgV56RvhQVoHeNbg== X-Received: by 10.194.65.72 with SMTP id v8mr57076716wjs.103.1470070525457; Mon, 01 Aug 2016 09:55:25 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by smtp.gmail.com with ESMTPSA id ub8sm25101172wjc.39.2016.08.01.09.55.24 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 01 Aug 2016 09:55:24 -0700 (PDT) Date: Mon, 1 Aug 2016 18:55:22 +0200 From: Mateusz Guzik To: Maxim Sobolev Cc: Adrian Chadd , John Baldwin , freebsd-current , Konstantin Belousov Subject: Re: [PATCH] randomized delay in locking primitives, take 2 Message-ID: <20160801165522.GB24633@dft-labs.eu> Mail-Followup-To: Mateusz Guzik , Maxim Sobolev , Adrian Chadd , John Baldwin , freebsd-current , Konstantin Belousov References: <20160731095706.GB9408@dft-labs.eu> <20160731203612.GH9408@dft-labs.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 16:55:27 -0000 On Mon, Aug 01, 2016 at 09:38:09AM -0700, Maxim Sobolev wrote: > On Sun, Jul 31, 2016 at 1:36 PM, Mateusz Guzik wrote: > > > On Sun, Jul 31, 2016 at 07:03:08AM -0700, Adrian Chadd wrote: > > > Hi, > > > > > > Did you test on any 1, 2, 4, 8 cpu machines? just to see if there are > > > any performance degredations on lower count CPUs? > > > > > > > I did not test on machines which physically that few cpus, but I did > > test the impact on microbenchmark with 2 and 4 threads on the 80-way > > machine. There was no difference. > > > > Well, arguably running 4 threads on a 80-way machine is not quite the same > as running the same 4 threads on 4-way or 8-way machine. Unless you > actually bind your test threads to a specific CPUs, on a bigger system > scheduler is free to migrate your thread on another CPU if all 4 are > spinning, this might not the option for smaller box. I suggest you at very > least re-run your benchmark on a virtual machine with small CPUs count > assigned, it should be quite easy to do so on your monster box. > The test does bind threads to cpus. Further, the dealy is autotuned based on the number of cpus in the system. I also once more stress that the backoff is extremely small and we don't take full advantage of it specifically so that detrimental behaviour is very unlikely. So here even on the 80-way machine with 80 * 25 initial delay there was no performance loss with only few threads competing. The worry could have been it helps only if all cpu threads compete and hurts performance otherwise. On an actual 4-way machine will have only 4 * 25 delays configured with 4 * 25 * 10 upper limit. But note the actual delay is cpu_ticks() % that value, so even that is often smaller. tl;dr this is really a simple patch and at least on amd64 a pure win -- Mateusz Guzik