Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp800081pxk; Mon, 31 Aug 2020 00:57:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIZlbKhNAwDTFrp1afDqEDEZDhVWbpSKNZiZpC6mMD19WyM+XqzlMlfJ9QOIq5my9VehcM X-Received: by 2002:a05:6402:17b9:: with SMTP id j25mr64476edy.203.1598860641594; Mon, 31 Aug 2020 00:57:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598860641; cv=none; d=google.com; s=arc-20160816; b=ZfRLMOrACg8OhR69dL+4JUg8v+4pPhYn8JIVO7YNtmkQbk8jwrU3wQnjH6rMLh2Qvy lzVxDM/8HZFh1IuiFYOgzmnXb93dwxFDVF3QhaIGkvHB+5H15pOq31GRcmP5qVWmFl4r aMcUqprR0lTCA2gN2wySZPnF9zfeWNnXo+i6w1aHgc18EWGmYPOpaIq3/6+E94fax0D5 L14YHk2E7vWp9sEDBCUkjNMrMNTha87mq/F0pjdDCPL9fqKrGze+wlQB/mW1RxJlG5Q5 +07BvZ/Brj/xx/ttN3FOvQLbCGuauYgak5LmCKQnmSgxv4//I24PQ295EXkMWiwTKQsz xvqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=/7U3F6FaKVuN/U/b1w7KzUfJSdCmghFrWGagbaA8hws=; b=oZJ0qUDisEi3yCc+pUPXnSgBZx7X+MCf4jsNy0nc+wDTSYmkPUagc894Xaaw4F0rrz bLn95xHWfhn4oBMrV5WJraQobB8TaHq2CyDGGp4fKfqInZcWw8wjqajKwUjDKZN/34oL dCq7kkpn5nrDPjYNpZYhWb8mU7ToVsEjvLVoHBkR0F/Syy1TZY8oD3gWVVkjn0nPOo7F uBX+zwjab0WKo/VcU7glpkd2x9DuCy9wOhN4HpfB9eLRU9Um5d63cvhXwFmVaycbNR+v Pikn9G7B+5irfvVs9KcI/iMBDYPBXWP2zB+3IkJNZF0hFvjQLG94XLG7GVadUHODMwNB C8Jw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z1si4896764ejd.673.2020.08.31.00.56.58; Mon, 31 Aug 2020 00:57:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727991AbgHaH4R (ORCPT + 99 others); Mon, 31 Aug 2020 03:56:17 -0400 Received: from mx2.suse.de ([195.135.220.15]:41416 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727961AbgHaH4P (ORCPT ); Mon, 31 Aug 2020 03:56:15 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 7C8FCAC85; Mon, 31 Aug 2020 07:56:48 +0000 (UTC) Date: Mon, 31 Aug 2020 08:56:11 +0100 From: Mel Gorman To: Feng Tang Cc: Borislav Petkov , "Luck, Tony" , kernel test robot , LKML , lkp@lists.01.org Subject: Re: [LKP] Re: [x86/mce] 1de08dccd3: will-it-scale.per_process_ops -14.1% regression Message-ID: <20200831075611.GA2976@suse.com> References: <20200818082943.GA65567@shbuild999.sh.intel.com> <20200818200654.GA21494@agluck-desk2.amr.corp.intel.com> <20200819020437.GA2605@shbuild999.sh.intel.com> <20200821020259.GA90000@shbuild999.sh.intel.com> <20200824151425.GF4794@zn.tnic> <20200824153300.GA56944@shbuild999.sh.intel.com> <20200824161238.GI4794@zn.tnic> <20200825062305.GA83850@shbuild999.sh.intel.com> <20200828174839.GD19448@zn.tnic> <20200831021638.GB65971@shbuild999.sh.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20200831021638.GB65971@shbuild999.sh.intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 31, 2020 at 10:16:38AM +0800, Feng Tang wrote: > > So why don't you define both variables with DEFINE_PER_CPU_ALIGNED and > > check if all your bad measurements go away this way? > > For 'arch_freq_scale', there are other percpu variables in the same > smpboot.c: 'arch_prev_aperf' and 'arch_prev_mperf', and in hot path > arch_scale_freq_tick(), these 3 variables are all accessed, so I didn't > touch it. Or maybe we can align the first of these 3 variables, so > that they sit in one cacheline. > > > You'd also need to check whether there's no detrimental effect from > > this change on other, i.e., !KNL platforms, and I think there won't > > be because both variables will be in separate cachelines then and all > > should be good. > > Yes, these kind of changes should be verified on other platforms. > > One thing still puzzles me, that the 2 variables are per-cpu things, and > there is no case of many CPU contending, why the cacheline layout matters? > I doubt it is due to the contention of the same cache set, and am trying > to find some way to test it. > Because if you have two structures that are per-cpu and not cache-aligned then a write in one can bounce the cache line in another due to cache coherency protocol. It's generally called "false cache line sharing". https://en.wikipedia.org/wiki/False_sharing has basic examples (lets not get into whether wikipedia is a valid citation source, there are books on the topic if someone really cared). While it's in my imagination, this should happen with the page allocator pcpu structures because the core structure is 1.5 cache lines on 64-bit currently and not aligned. That means that not only can two CPUs interfere with each others lists and counters but that could happen cross-node. The hypothesis can be tested with perf looking for abnormal cache misses. In this case, an intense allocating process bound to one CPU with intermittent allocations on the adjacent CPU should show unexpected cache line bounces. It would not be perfect as collisions would happen anyway when the pcpu lists spill over on either the alloc or free side to the the buddy lists but in that case, the cache misses would happen on different instructions. -- Mel Gorman SUSE Labs