Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3730449imm; Tue, 17 Jul 2018 09:20:59 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcmxlOBAfo1mUhcEmIjx14hs9Xz4REnyuvyv5rbIl9iHjEnOWclv/mi1YFEEFPNSGYggm38 X-Received: by 2002:a17:902:2702:: with SMTP id c2-v6mr2207329plb.297.1531844459352; Tue, 17 Jul 2018 09:20:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531844459; cv=none; d=google.com; s=arc-20160816; b=ebPlkWnJB0/S6oryQdDRaBsPwNafGTg7H2DmhgPVfhPKCv0nhp1z+ewBHOWMTLXbXz 8gwIcYeuvagcR0lMZzass+1DbwnGITGDerdJsQFeCijxtkrcQzaQIQUkHu2lNBmxDu0a YqbuFOQMDer6hssUasirk5MjsGFwrHpvKhibASymH6yLTx66z4a22A5NUWBsb1J98iez 7qEOQIbpm7HUBzy8HyHfEm0uAlyfR5EKBpVsVh3YnaZgIybrIyqiUELcO0kMWfWuofop 2Ky321UXCDVtQdlzGMlCiH85qMS9mIy9SoAwyNwT/p/46ARE1xinIt0uJak1/OtGNKJ9 veKg== 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=WkfMYeCbokiQrbIifildJl2CLfg7aDjQzDmBkjg/4fk=; b=v1RXQutNKQfHBMPGamAY503jl76rh5oUE3jeHk2NCK1SrEAmta2gDfkUdTSB3Wkt9B VmYKCYiP+X17kQwkMN/6g5i1LN1T4KYweBqI47r172OkD0y9ctU12FFa+S42wKtH+dQp BbUtjwvNNvWX8uvCxnPGJGuCxCj1KVDjHTwd61xhmnJj/pBv6Q9Ez9k61ZT4kVUwE6+o AJBMuk3+dzW/plIn4n4ZlJBMfPE+4RX6mQpRNK7DO5VL9XQxPt4P2KR8WD2Sy3xDt/L5 C1FWbX7tPYahWiHOnUwpvg6Dj85V+E15D0rwt63Lg2OY1Cgk5/3vs6PY5vnxWSFBfKna /aeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=ALAHt+0n; 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 h71-v6si1129921pge.13.2018.07.17.09.20.43; Tue, 17 Jul 2018 09:20:59 -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=ALAHt+0n; 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 S1729927AbeGQQww (ORCPT + 99 others); Tue, 17 Jul 2018 12:52:52 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:36589 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729600AbeGQQww (ORCPT ); Tue, 17 Jul 2018 12:52:52 -0400 Received: by mail-io0-f194.google.com with SMTP id k4-v6so1485128iob.3 for ; Tue, 17 Jul 2018 09:19:27 -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=WkfMYeCbokiQrbIifildJl2CLfg7aDjQzDmBkjg/4fk=; b=ALAHt+0nnMAqbSPoy2g6Vz/qM2UHiRFjUI7UNOorKKK+SvA3ye2WqnjKJyPD870P1X T42qjVW+1SGX/wl2xQ0x+2fVOnmOqGiL3CjQT8HCEa/Qs+rFV0z9H5SFivnZH6a2qzHL EyAGMM0zylcKqWrpD8/QIAExP3WrR1VXV5oXY= 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=WkfMYeCbokiQrbIifildJl2CLfg7aDjQzDmBkjg/4fk=; b=Qmbp9E9/kjblgDg371hT6iJ9OjCtR2ndMMJtXSz32/YzXmPS51W1XH/XAyxLOZoaoC +skW9gJgLHmRQKGemFq+kNR7Rjtc7QFhPkeeI+uRq3FzTa3ZEPDKsOpIWbPF+DF5QwiZ vf4YwSjdq9TKxIgNybpFttOmHOrWMLqFnsb3Ft5d+7nAUDf5VSK6dq1LKYdrTRok7ymT 5JKARPQvbfkdTD1FBJtsXnHflI86oPe09xOPqo7cm9moZgimLzmNRws76lNxHZ71oRfJ XA6gQ3wNuuX7y5Je5yMb06N5r9SohwdZnIKKEZgpIbFSa5lQgemIhji+x5QBocLW4cEf E/8A== X-Gm-Message-State: AOUpUlF6JFNfLcFtLjqlXC70608O2TlrU/0LENCAggcwaxN4YDbGTHeU RJvzjiuULDtI7P/I9b4M9IbKTcKU1hbsMsMbVLU= X-Received: by 2002:a6b:1502:: with SMTP id 2-v6mr2130951iov.203.1531844367193; Tue, 17 Jul 2018 09:19:27 -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> <87va9dyl8y.fsf@concordia.ellerman.id.au> In-Reply-To: <87va9dyl8y.fsf@concordia.ellerman.id.au> From: Linus Torvalds Date: Tue, 17 Jul 2018 09:19:15 -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 Tue, Jul 17, 2018 at 7:45 AM Michael Ellerman wrote: > > > Interesting. I don't see anything as high as 18%, it's more spread out: > > 7.81% context_switch [kernel.kallsyms] [k] cgroup_rstat_updated Oh, see that's the difference. You're running in a non-root cgroup, I think. That also means that your scheduler overhead has way more spinlocks, and in particular, you have that raw_spinlock_t *cpu_lock = per_cpu_ptr(&cgroup_rstat_cpu_lock, cpu); .. raw_spin_lock_irqsave(cpu_lock, flags); there too. So you have at least twice the spinlocks that my case had, and yes, the costs are way more spread out because your case has all that cgroup accounting too. That said, I don't understand the powerpc memory ordering. I thought the rules were "isync on lock, lwsync on unlock". That's what the AIX docs imply, at least. In particular, I find: "isync is not a memory barrier instruction, but the load-compare-conditional branch-isync sequence can provide this ordering property" so why are you doing "sync/lwsync", when it sounds like "isync/lwsync" (for lock/unlock) is the right thing and would already give memory barrier semantics? Linus