Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2698017imm; Mon, 16 Jul 2018 12:31:09 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeWgGP0T8cpxI8PVR9MceCyrp/jgzenUhM6YGjMQwjR9b4RHJYEurNj21yz7gtYJ9x1ggCf X-Received: by 2002:a62:9683:: with SMTP id s3-v6mr19219314pfk.191.1531769469672; Mon, 16 Jul 2018 12:31:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531769469; cv=none; d=google.com; s=arc-20160816; b=WkrNKMOL1VWUaRMhc9amM4/LXn6/WdhaP9Q+jw+NvVwT9/LyRn17RCD5KM6Ja9v1Vo /F2cELiVssf70HjB46lLhr6a3pfjSsjQkKmcTRIDjSTwvLFE7NmVKTQs6L0Y2dRex3T2 xRd6Dh5R6YacWk+ahY3lpZoKF3TJy/LXq6xvSrxUo8yw3+tNZSdR4p7LMMJ/DzB/6gwL q2td/LWutf1nlQLF58u73vumdWqV/JUg8eB5NQT44x10UAOLl7u/0ygWY2O9PRFffYQ2 4b3nAjD5FX86Tsjr10znQoPRrjNM1Xeke5MBS2T0QwcULKdlS510mYmoUIF83vjfbBX4 0nxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=5tblEWJAkxnWjkLrth4QxGXaRt2ur5mdFARlDS6TuQQ=; b=HBiKm/5NNC6aUWyQIdxDYSyI8WsftsmGfo08KLF7pTC9J2QRsnMf6lpBaj2Q9Cxj7C ySCQQVOW/JG/m5ElWMX4z3VjsgysrhKBZqVZ9fTJsaIgAJ2yqXvlHPBkLGZIi9rcVWJq M3qT6aefUaJeQXJA9PtJ69F6pgX5omCevXHmFUwsHlQR/2HiB5rRfN++HtluVu/Bxwhd 91sO62SWl18u7zwMmUmaNGBpbODeTdBNiqIUerSPi619wDZtEK7nnIWVVE2l9KF1a/Nx Kmh9K54iMMn87DSAZI/yszbgslGTkLLLZvTxOwEgiSlPhxOYEaw5r/gDM0QxDNFWU404 CDkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=X5A1lsUX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a67-v6si33480419pfb.348.2018.07.16.12.30.54; Mon, 16 Jul 2018 12:31:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=X5A1lsUX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729980AbeGPT7L (ORCPT + 99 others); Mon, 16 Jul 2018 15:59:11 -0400 Received: from mail-io0-f196.google.com ([209.85.223.196]:39502 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728075AbeGPT7K (ORCPT ); Mon, 16 Jul 2018 15:59:10 -0400 Received: by mail-io0-f196.google.com with SMTP id e13-v6so38914431iof.6 for ; Mon, 16 Jul 2018 12:30:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5tblEWJAkxnWjkLrth4QxGXaRt2ur5mdFARlDS6TuQQ=; b=X5A1lsUXZH2bx9qMVwSO+/i26sdanFXjjL1A2fFB6xa21snGoS7L+g9tNa0E0YXSWV BpNUBg0w0KG/NwwpNdNBMmYj62jPqCv7Sk4T9dIv0OOrbQHiVWkFhPRZWU4DuIoeHzmM Mp91JQbWvA2elxKITeHFSNWZcip6w7I8Hm98I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5tblEWJAkxnWjkLrth4QxGXaRt2ur5mdFARlDS6TuQQ=; b=NIM3t9zoJDvOeg+POaXRsREYuEP05ojkD0BPuTqx5/6CCMBq44VsAVc9whBmXpog3r Jfx4OhquKpD/d7r8QqNdC6g2UBs7UIkJ62gsU+q9usBhMLugRvFM5a9k5zhVte0JmDHv 2Kefb/q8p8WeFo3sBe7niSi0J+c7/uxWaVZew0EKsSCAYNnTxYGqFzMUZCKJ0zFGT6q1 mrAWTL5O/00Wpil/NW6TsUQcea3FBBi/kXqF4Z1IzF7RnODrbkGfBVBrBK8HfWRpETvy SZaks9CVk0PVRA+w8Rwu0luubZHt58xAIVzmPyrlaIIq0AWnEzeTzn/s0yl07Qj4gqM2 trAQ== X-Gm-Message-State: AOUpUlFOa4z6ITdzsT21eDWbGX3ir63KbWPO56L6ia1kzptDOydi8X9K ONfMrb5T1cWt4UUKPLeMRWuabvvC8j+o1UJwqEE= X-Received: by 2002:a6b:274f:: with SMTP id n76-v6mr42620179ion.259.1531769419074; Mon, 16 Jul 2018 12:30:19 -0700 (PDT) MIME-Version: 1.0 References: <20180712134821.GT2494@hirez.programming.kicks-ass.net> <20180712172838.GU3593@linux.vnet.ibm.com> <20180712180511.GP2476@hirez.programming.kicks-ass.net> <20180713110851.GY2494@hirez.programming.kicks-ass.net> <87tvp3xonl.fsf@concordia.ellerman.id.au> <20180713164239.GZ2494@hirez.programming.kicks-ass.net> <87601fz1kc.fsf@concordia.ellerman.id.au> In-Reply-To: <87601fz1kc.fsf@concordia.ellerman.id.au> From: Linus Torvalds Date: Mon, 16 Jul 2018 12:30:07 -0700 Message-ID: Subject: Re: [PATCH v2] tools/memory-model: Add extra ordering for locks and remove it for ordinary release/acquire To: Michael Ellerman Cc: Peter Zijlstra , Paul McKenney , Alan Stern , andrea.parri@amarulasolutions.com, Will Deacon , Akira Yokosawa , Boqun Feng , Daniel Lustig , David Howells , Jade Alglave , Luc Maranget , Nick Piggin , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 16, 2018 at 7:40 AM Michael Ellerman wrote: > > If the numbers can be trusted it is actually slower to put the sync in > lock, at least on one of the machines: > > Time > lwsync_sync 84,932,987,977 > sync_lwsync 93,185,930,333 Very funky. > I guess arguably it's not a very macro benchmark, but we have a > context_switch benchmark in the tree[1] which we often use to tune > things, and it degrades badly. It just spins up two threads and has them > ping-pong using yield. I hacked that up to run on x86, and it only is about 5% locking overhead in my profiles. It's about 18% __switch_to, and a lot of system call entry/exit, but not a lot of locking. I'm actually surprised it is even that much locking, since it seems to be single-cpu, so there should be no contention and the lock (which seems to be rq = this_rq(); rq_lock(rq, &rf); in do_sched_yield()) should stay local to the cpu. And for you the locking is apparently even _more_ noticeable. But yes, a 10% regression on that context switch thing is huge. You shouldn't do ping-pong stuff, but people kind of do. Linus