Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp823235pxk; Mon, 31 Aug 2020 01:56:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbuH/0DeQPb26jViGc1ErlSPN0YFPM6G3qbxltFzCtCKS/ZUwZiW/shBc+A+qYcOMC3ILh X-Received: by 2002:aa7:ca19:: with SMTP id y25mr221308eds.211.1598864196707; Mon, 31 Aug 2020 01:56:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598864196; cv=none; d=google.com; s=arc-20160816; b=FBoU93e7fl1r2wzNp/diS3b1qLZhrmOoR3M7qcOYEhGsjOqgj0EJkbv8ZZss9eYtxk yKrfT0o3AAUyaXYzdmEr7io0yjsKKynH2rF++e+9lnsK1acx7l6iBiBmLnPrk+8HA9Rj L9ihQGH+3SQV1T7VFqV7C8Rci1yBtSYSpfK5qo+o2EBCPMuCCuPsFTIz2dTBOYoGy94q FZqPsTEVd2cTHF+oETXyANWz9slorRhZMdFKW1QD1ZtPyIByG9MflTANkr7FuWgjN3C7 kEsCfG9LQ248a0zqT9/eZHrTvOk3CqaRiQY5+7I6VvsENfz2XGY6iea6/aTaUG7DgNKT qPmQ== 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=cv8I1xPORyOSxMQygFDpIve/IQEsNbj9SchNh9KGRWU=; b=vQVJNB65fJf441SUgYYwALSLhMkDJxGWn+VhHz3XOFuhh0/EtLSLRkat0LmCYeQAPV RmjFqtvoZMymh8DZO+C0gCJfeookAjrKHe3utDTC+Moz4SbWfFyHd2hYEuOXTnKAQbOG Mm8Np/AJmiVF7UndWWNQJmgfz9sQ4f576miPV5yDOz6Lp8timv9TVqFu+hv8vxsomuA9 Vv0XhAUZE+QM8LnquKJQ9ucpktQ4Qw6BppvAynx8vA0jy9fvfmUgfhPMOxX6XJaJ6nhm dfRMNvGvkAu7ULCNEo9J60zBQILqCFhwGOp3hmsOqmqfrvEUT/5JTe0lX00joowKTDaZ 4K/g== 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 e15si5220356ejz.137.2020.08.31.01.56.13; Mon, 31 Aug 2020 01:56:36 -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 S1727979AbgHaIzU (ORCPT + 99 others); Mon, 31 Aug 2020 04:55:20 -0400 Received: from mx2.suse.de ([195.135.220.15]:55472 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725978AbgHaIzU (ORCPT ); Mon, 31 Aug 2020 04:55:20 -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 89E3CABC1; Mon, 31 Aug 2020 08:55:53 +0000 (UTC) Date: Mon, 31 Aug 2020 09:55:17 +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: <20200831085516.GE2976@suse.com> References: <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> <20200831075611.GA2976@suse.com> <20200831082306.GA61340@shbuild999.sh.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20200831082306.GA61340@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 04:23:06PM +0800, Feng Tang wrote: > On Mon, Aug 31, 2020 at 08:56:11AM +0100, Mel Gorman wrote: > > 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). > > For 'arch_freq_scale' and 'tsc_adjust' percpu variable, they are only > accessed by their own CPU, and usually no other CPU will touch them, Read "false sharing again". Two adjacent per-CPU structures can still interfere with each other if the structures happen to cross a cache line boundary and are not cache aligned. > the > hot node path only use this_cpu_read/write/ptr. And each CPU's static > percpu variables are all packed together in one area (256KB for one CPU on > this test box), If the structure is not cache aligned (probably 64KB) then there is a boundary when cache line bounces can occur. -- Mel Gorman SUSE Labs