Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3350118ybc; Mon, 18 Nov 2019 13:50:33 -0800 (PST) X-Google-Smtp-Source: APXvYqznbqH+iOAJJtGGQnXIwJvbyV9M4OSIi3owrxXrPSbX91bgO4zhPx/xORktnrXPzaipaCUm X-Received: by 2002:a17:906:9417:: with SMTP id q23mr29933835ejx.37.1574113833695; Mon, 18 Nov 2019 13:50:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574113833; cv=none; d=google.com; s=arc-20160816; b=JfakoBVIn7YoHQh0P5C65qUnULZMaFbeG9aOZ4jEA+B/WF3ODL2Bo0DPu4mPZ3zyx6 OWRbLereqnsmEGiaX0zezDB4oyrC2UTOg4dESAjpSie2ciTHKcrjD4oTi3bXBmb61XBg IzMSinrof2jvoZku9HV5MVQbtRPvS2krUl6y1+uDfeneeFRNLOEusfvCvI8Fl66Q2Ti/ eHEud9/TDhbhdlsHfpsNVM2wJabyDRExbv3NLrGxwIs7TWP0UvI8CmKepB+kU+yVaXi2 nKF3MjXig5/ITMhbWrrtDKCWXvoE/CFOjiQ5mFZEvaqKKlIjd5p/+ewDmUfIUfpk7o55 aP+Q== 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:date:from:dkim-signature; bh=q4B0Yr9MAH2OOg9e+2b4uJAfwJytTTL68mfbk8OBhyw=; b=JkNh870vxyB8MbZf5L2/Da9j4XAS8OT4p3yh7zN0FreMqFb5dUwANWSdkwRCyJVsho ALcJIGqFi75U6pbLPGhncbv9WaSztwk9YYJCZcxP98GJvdJW4IO/u0jK2NSEOCcrNJ5f dOSg95h2e33KjlvFHxKRCnalu2LB2F0Pm8wq8RlR9MBpON/k0fbzMAcJM+wa30s6pjs3 dKdRUoo1sDvybz6VQFcNz04LgAc+R29l8KRePXhC/yhZv1Kns3i2p7uISo4T2wpabW/s Ohbhay+z/1Kl8Xi71pRcJ3YBMMbUyOJ6GcX3/qvGJ0hbo2iV3hEfaCmcK0wyKZxAiwUH qdkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Vvfbp0Or; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c36si14750245edf.165.2019.11.18.13.50.09; Mon, 18 Nov 2019 13:50:33 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Vvfbp0Or; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726920AbfKRVs4 (ORCPT + 99 others); Mon, 18 Nov 2019 16:48:56 -0500 Received: from mail-qk1-f195.google.com ([209.85.222.195]:44510 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726647AbfKRVs4 (ORCPT ); Mon, 18 Nov 2019 16:48:56 -0500 Received: by mail-qk1-f195.google.com with SMTP id m16so15897311qki.11 for ; Mon, 18 Nov 2019 13:48:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=q4B0Yr9MAH2OOg9e+2b4uJAfwJytTTL68mfbk8OBhyw=; b=Vvfbp0OrCgdTvICqPVO8WcPkW9ijaNwWbxmlSk+D0EB0YpBzPn4ZZb+f5PIT7mxvsx x9NNZkBMQtjQXI6jy+fWLutZ/8OjtFanDkSZZgvM5DZNk004u3iHO92IMg8qJy5EJhdu 97ZCm6xODzY87FDX4AI/jgMj5Ta8+IdwEZgN8AaaaobIylkwXDmMtlnJsEYRJpAOWThT 1deIAVVSuFAtkzY8uiwN4p2VwJ6I+CiO9Y0iDPpSj/uf+T6D2wZrTB2arJ/IK7pWWS/r xqtMPydC8hkGr+noMhvdheSIzaeUM/7OarjFia7hj/SEwi4gw+OzTjhk2uFQn86vO9nt yePw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=q4B0Yr9MAH2OOg9e+2b4uJAfwJytTTL68mfbk8OBhyw=; b=SREifwLMghKV5lzrTxOr3K4qEka4+HDDvNzTFgW3EER7pGrrfNyguv39qNdz+7/XmN YlOb9tNYmReQIl6Oo4ZQhkvGaN44iUp1m7orkjb5TIzjs4dOEI+tMlO+Sv+9bf5bDm8p vvzK9Gz3dyo9yEaR7KCWzizLyNGdUwxM41QkaLQw1rkk+uWbeseQoW7Xvs1p9paBQ+0b 6s0MOhp8WyyjbkjccRotOb0a9pdBONtLdw8kFOVydNYmnUkiUh8Z3ojTAm84UkgoQSjk xK7cG22ARitKuYDreAJpirZRwD2fzJmkXeWeokYUmVcVv3HLmBsemym6CXVLNeTUrT5b iqPQ== X-Gm-Message-State: APjAAAXOYlux643daxwBZBi5aBNrzClTmGsuvjswo+JHKW/JZdoOSi7g 7PO0Mdc2va+HMChoBZIMB9k= X-Received: by 2002:a37:9d12:: with SMTP id g18mr24162968qke.157.1574113734704; Mon, 18 Nov 2019 13:48:54 -0800 (PST) Received: from quaco.ghostprotocols.net ([179.97.35.50]) by smtp.gmail.com with ESMTPSA id i41sm11427666qti.42.2019.11.18.13.48.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2019 13:48:53 -0800 (PST) From: Arnaldo Carvalho de Melo X-Google-Original-From: Arnaldo Carvalho de Melo Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 71C4840D3E; Mon, 18 Nov 2019 18:48:51 -0300 (-03) Date: Mon, 18 Nov 2019 18:48:51 -0300 To: Jiri Olsa Cc: Jiri Olsa , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Andi Kleen , Stephane Eranian , Jin Yao , Alexey Budankov Subject: Re: [PATCHv2 0/2] perf tools: Share struct map after clone Message-ID: <20191118214851.GA17315@kernel.org> References: <20191016082226.10325-1-jolsa@kernel.org> <20191023075517.GA22919@krava> <20191029205855.GA20826@krava> <20191118121400.GA14046@krava> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191118121400.GA14046@krava> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Mon, Nov 18, 2019 at 01:14:00PM +0100, Jiri Olsa escreveu: > On Tue, Oct 29, 2019 at 09:58:55PM +0100, Jiri Olsa wrote: > > > > > > > > Also available in here: > > > > git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git > > > > perf/map_shared > > > I rebased to latest perf/core and pushed the branch out > > rebased and pushed out > heya, > I lost track of this.. what's the status, are you going with your > version, or is this one still in? I don't see any of them in latest > code.. So, I'm still working on and off on this, current status is at: https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=perf/map_share Its just one patch more than perf/core, the one that does the sharing. The thing is, as I'm going over all the fields in 'struct map', it seems that we'll end up with just one cacheline per instance, as there are things there that are not strictly related to a map, but to a map_group (unmap_ip/map_ip), or to a dso (maj, min, ino, ino_generation), and some need less than what is allocated to them. Current status is: [root@quaco ~]# pahole -C map ~acme/bin/perf struct map { union { struct rb_node rb_node __attribute__((__aligned__(8))); /* 0 24 */ struct list_head node; /* 0 16 */ } __attribute__((__aligned__(8))); /* 0 24 */ u64 start; /* 24 8 */ u64 end; /* 32 8 */ _Bool erange_warned:1; /* 40: 0 1 */ _Bool priv:1; /* 40: 1 1 */ /* XXX 6 bits hole, try to pack */ /* XXX 3 bytes hole, try to pack */ u32 prot; /* 44 4 */ u64 pgoff; /* 48 8 */ u64 reloc; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ u64 (*map_ip)(struct map *, u64); /* 64 8 */ u64 (*unmap_ip)(struct map *, u64); /* 72 8 */ struct dso * dso; /* 80 8 */ refcount_t refcnt; /* 88 4 */ u32 flags; /* 92 4 */ /* size: 96, cachelines: 2, members: 13 */ /* sum members: 92, holes: 1, sum holes: 3 */ /* sum bitfield members: 2 bits, bit holes: 1, sum bit holes: 6 bits */ /* forced alignments: 1 */ /* last cacheline: 32 bytes */ } __attribute__((__aligned__(8))); [root@quaco ~]# This is with the tentative move of maj/min/ino/ino_generation to 'struct dso', but that needs more work to match the sort order that touches it "dcacheline", i.e. a map that comes with the same backing DSO but different values for those fields is not the same DSO, right? Right now with moving the maj/min/etc to dso, in the map_share patch we get the structure used to keep shared entries in the rb_tree at 40 bytes, under one cacheline, while the full 'struct map' is 32 bytes more than one cacheline, so still good for sharing: [acme@quaco perf]$ pahole -C map_node ~/bin/perf struct map_node { union { struct rb_node rb_node __attribute__((__aligned__(8))); /* 0 24 */ struct list_head node; /* 0 16 */ } __attribute__((__aligned__(8))); /* 0 24 */ refcount_t refcnt; /* 24 4 */ _Bool is_node:1; /* 28: 0 1 */ /* XXX 7 bits hole, try to pack */ /* XXX 3 bytes hole, try to pack */ struct map * map; /* 32 8 */ /* size: 40, cachelines: 1, members: 4 */ /* sum members: 36, holes: 1, sum holes: 3 */ /* sum bitfield members: 1 bits, bit holes: 1, sum bit holes: 7 bits */ /* forced alignments: 1 */ /* last cacheline: 40 bytes */ } __attribute__((__aligned__(8))); [acme@quaco perf]$ pahole -C map ~/bin/perf struct map { union { struct rb_node rb_node __attribute__((__aligned__(8))); /* 0 24 */ struct list_head node; /* 0 16 */ } __attribute__((__aligned__(8))); /* 0 24 */ refcount_t refcnt; /* 24 4 */ _Bool is_node:1; /* 28: 0 1 */ _Bool erange_warned:1; /* 28: 1 1 */ _Bool priv:1; /* 28: 2 1 */ /* XXX 5 bits hole, try to pack */ /* XXX 3 bytes hole, try to pack */ u64 start; /* 32 8 */ u64 end; /* 40 8 */ u64 pgoff; /* 48 8 */ u64 reloc; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ u64 (*map_ip)(struct map *, u64); /* 64 8 */ u64 (*unmap_ip)(struct map *, u64); /* 72 8 */ struct dso * dso; /* 80 8 */ u32 flags; /* 88 4 */ u32 prot; /* 92 4 */ /* size: 96, cachelines: 2, members: 14 */ /* sum members: 92, holes: 1, sum holes: 3 */ /* sum bitfield members: 3 bits, bit holes: 1, sum bit holes: 5 bits */ /* forced alignments: 1 */ /* last cacheline: 32 bytes */ } __attribute__((__aligned__(8))); [acme@quaco perf]$ So give me some more time, please :-) The sharing map is this one, without the maj/map/ move to 'struct dso': https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?h=perf/map_share&id=451df1d4ad3c636f6be57b8e69b4f94c1bbf4a65 - Arnaldo