Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3432904ybl; Fri, 20 Dec 2019 09:11:46 -0800 (PST) X-Google-Smtp-Source: APXvYqwc+HUqvTLzhsxtyVqQkDjMLo8FcjZ3tvNtWN7XY3GCcwvDFpY0TMqoT9EaeqVOuSzXeKW5 X-Received: by 2002:aca:a811:: with SMTP id r17mr4412832oie.59.1576861906592; Fri, 20 Dec 2019 09:11:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576861906; cv=none; d=google.com; s=arc-20160816; b=p5r/P/TEA+DjjlfDiEt3dekLtWuYDebykmcrq38IRmDScaty7lwAqiZF2wbYTl2eWD NPKaT9FLPnsCYlCwqDodk6T3anIzJHbFya/ytxLgoH/zI0rdr/rPJwPTdErAnAKpAzuY fP9hA0TWCNBRUcgD+h0gDBpVg+md1ls1dtOxu0hDFDwTW+stsgP4DJfD2V2WE/789Nda iyr7y+mFhe+KKvEsIAvtmvVLTR3GJ1UHEAxuXIxBEkufffh3xy4ShnI2+ZulF4VeeGBh TH3mRXeN/WSNxyiLsJui1Lw6Z8Qm16RRRLirmQXkk6+uznp0ScE6NKsGbkb7dtnvw37l dW3w== 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=ferOHgTa8+mlLQrIZxEyrkrIqrPKTFyh2LphB/p/Y74=; b=UNIERU8waC9/K+UvVxBZROFAzjxgWlX8ZEqYXrim00zZ9tL7+TZiHAZcDl4HhvHAkp ikH/R0BHULGG+FoCuHLT5vnO5M4fbTjxbKSRwMDMGGgetASbfHYM9x0QyLA1yXFvmA10 k8lmAuZ0H/oymaU9U2qNdU6qZ5A8ETFuSgjnKzZrHcmqgR/MxYZIIzU8hBy5qoRRypCS tw9rjBa3ABVBY0mId1IIsctpiVFjMFX7eiObBr+siz5wLBbwQHO4USPrvvb8zRzhuE+3 FAIyCL/tFfPfNl2M1UXVuY/SGHUlCaDEkTWfq+qFNOnEWbz0RAEvky3gcP92GN5q5TRP pyPg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l84si4880161oig.5.2019.12.20.09.11.29; Fri, 20 Dec 2019 09:11:46 -0800 (PST) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727508AbfLTRKN (ORCPT + 99 others); Fri, 20 Dec 2019 12:10:13 -0500 Received: from mail-qt1-f177.google.com ([209.85.160.177]:41399 "EHLO mail-qt1-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727492AbfLTRKJ (ORCPT ); Fri, 20 Dec 2019 12:10:09 -0500 Received: by mail-qt1-f177.google.com with SMTP id k40so8778566qtk.8; Fri, 20 Dec 2019 09:10:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ferOHgTa8+mlLQrIZxEyrkrIqrPKTFyh2LphB/p/Y74=; b=Ap0rfrdfbbLbLNGVD/0/6sdxw7QE6ImhrXMatl7LwaEfi8kmACmuENu/+EjXFWhad0 SyEHb9WaxymkZzKML9Gvm9r7jBw1HjLi6w8CrBmVLVK49Hq9tnvXd1sFi0hWlAnFk5Sq OniO8I0UMWWNv0HVOTxbOG7KL7v1Zl/KQDkdx0xhpFGjM+JiC0og1VvAdFIhfdmVTfAK o4DQBbwDYgL+Dd2LyKOCnEC9cJPufcceU/oLvKp8tWFycR8wjuWv3S6oWTG4R+kEL7LK hK+S3IycE5CIgNFq8lmo2SBSkjB6Q4ZptbAiM9dTXqcLJWx286T5fi4mgZe3+676meyU 6g7g== X-Gm-Message-State: APjAAAWuFvohAKWvKyjlfGLPHLhxfdQ9OCC7Z9x92Hs8XZAxVznj4YfU ZDwYZNWC4Qj2r/ifOZjC9TQ= X-Received: by 2002:aed:3fb7:: with SMTP id s52mr12533978qth.311.1576861808329; Fri, 20 Dec 2019 09:10:08 -0800 (PST) Received: from dennisz-mbp.dhcp.thefacebook.com ([2620:10d:c091:480::8d30]) by smtp.gmail.com with ESMTPSA id k14sm2977023qki.66.2019.12.20.09.10.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2019 09:10:07 -0800 (PST) Date: Fri, 20 Dec 2019 11:10:04 -0600 From: Dennis Zhou To: Christopher Lameter Cc: Tejun Heo , Jesper Dangaard Brouer , =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= , bpf , LKML Subject: Re: Percpu variables, benchmarking, and performance weirdness Message-ID: <20191220171004.GA8596@dennisz-mbp.dhcp.thefacebook.com> References: <20191220103420.6f9304ab@carbon> <20191220151239.GE2914998@devbig004.ftw2.facebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 20, 2019 at 03:36:51PM +0000, Christopher Lameter wrote: > On Fri, 20 Dec 2019, Tejun Heo wrote: > > > On Fri, Dec 20, 2019 at 10:34:20AM +0100, Jesper Dangaard Brouer wrote: > > > > So, my question to the uarch/percpu folks out there: Why are percpu > > > > accesses (%gs segment register) more expensive than regular global > > > > variables in this scenario. > > > > > > I'm also VERY interested in knowing the answer to above question!? > > > (Adding LKML to reach more people) > > > > No idea. One difference is that percpu accesses are through vmap area > > which is mapped using 4k pages while global variable would be accessed > > through the fault linear mapping. Maybe you're getting hit by tlb > > pressure? bpf_redirect_info is static so that should be accessed via the linear mapping as well if we're embedding the first chunk. > > And there are some accesses from remote processors to per cpu ares of > other cpus. If those are in the same cacheline then those will cause > additional latencies. > I guess we could pad out certain structs like bpf_redirect_info, but that isn't really ideal.