Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp144009ybt; Mon, 6 Jul 2020 06:09:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMA4Q3GYm4ZyA+e3sh5iYTX2cTDj87aFraKzMim3jIGKDRwjndcCV+LH24aMtNYjikmSln X-Received: by 2002:a50:ee8d:: with SMTP id f13mr53601995edr.302.1594040959680; Mon, 06 Jul 2020 06:09:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594040959; cv=none; d=google.com; s=arc-20160816; b=jEFD+eTsZtJGCzg48SrhgZszxCE+wMNPdnFfIldirMAv8QiMLp5IOy/5usICCuDtSG cua1QjCJGgEtHUG4XQ2NCnCRISlzrGHzLh/sMwDoGTnN+1fANwvyzLfr79DK0uTdzE/r c0VvghZbvphb9OluxCHuaOtUvBziobtJFw5NqHwEPmDGGqNoZIi+NOyziVj/Q8XmA9TA SdQ0YNQ1RDzGSYS6DGFy3wTdO33XwgbL5mWiObxnhJDS1DINaKTN97+Ksp/nXTyl6cqd JBh702bt0YcpftnzGr7e0nO0KupIiSduOk3XmZYk/hnw3NSczmof6JdaE7F2HRA1sPhm PrDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject:ironport-sdr :ironport-sdr; bh=cEt/naKRgDYHCHiBhRTGVGYR2WRADCuzwvu/hwnrZRI=; b=LXdMHg6f8OUrrT9QKInUkhak8zdNqc+24PUEXLuJY9sgRReT7TxgMQTxXoLsizCn/B WnovfrniV6vEvWC0CPaAHG+AdwFbVPj600+/qnpGOLXzK66JV5Har46jUMGg/zSpiU/h DqGnzOb+VxtS/rncLoLLT1UuLfFwlin9xYDSbOtLmrdI66YNTLIEoQY6APDmlho+grl+ v49MG6WjwNVYVfCl+OhxepmrQp/CAArCp1CwfD/RFvKTDQDPJWPUM1Bm5JgQMDk0RaOr syT7nPI5gd8L2gpAzhUB6R+gLH03xD0zKSxt9m3j7KniHvQJzcYP49xWZTirDNgaj895 X4vQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s24si6711910edw.69.2020.07.06.06.08.56; Mon, 06 Jul 2020 06:09:19 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729115AbgGFNGA (ORCPT + 99 others); Mon, 6 Jul 2020 09:06:00 -0400 Received: from mga14.intel.com ([192.55.52.115]:54386 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729072AbgGFNGA (ORCPT ); Mon, 6 Jul 2020 09:06:00 -0400 IronPort-SDR: z3jAbM14aDygqBXuqo9dx3mHcbdWco+5nnCV0Pp7LYkSoQn38+OCSUVsJbF0xyYs9nEC6MMo/m 7jK+EutUg3Gw== X-IronPort-AV: E=McAfee;i="6000,8403,9673"; a="146488585" X-IronPort-AV: E=Sophos;i="5.75,320,1589266800"; d="scan'208";a="146488585" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2020 06:05:57 -0700 IronPort-SDR: aYS46YDa8awy/eI/dw9Hx3SLOfW/Nqbkc4B3A7/eh8+yYhWw5sZ6z2f6XllRLaxaNHr9FJu4ye XK/Ri+ojY3RA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,320,1589266800"; d="scan'208";a="313956434" Received: from linux.intel.com ([10.54.29.200]) by orsmga008.jf.intel.com with ESMTP; 06 Jul 2020 06:05:56 -0700 Received: from [10.249.225.12] (abudanko-mobl.ccr.corp.intel.com [10.249.225.12]) by linux.intel.com (Postfix) with ESMTP id 44698580378; Mon, 6 Jul 2020 06:05:49 -0700 (PDT) Subject: Re: [PATCH v9 02/15] tools/libperf: add properties to struct pollfd *entries objects To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Andi Kleen , linux-kernel References: <09bbbc85-7ef9-ff9f-9865-fce6a1a4e903@linux.intel.com> <20200706122413.GB3401866@krava> From: Alexey Budankov Organization: Intel Corp. Message-ID: Date: Mon, 6 Jul 2020 16:05:48 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200706122413.GB3401866@krava> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06.07.2020 15:24, Jiri Olsa wrote: > On Fri, Jul 03, 2020 at 10:41:45AM +0300, Alexey Budankov wrote: >> >> Store boolean properties per struct pollfd *entries object in a >> bitmap of int size. Implement fdarray_prop__nonfilterable property >> to skip object from counting by fdarray_filter(). > > ok, I think can do it like this, few comments below > > thanks, > jirka > >> >> Signed-off-by: Alexey Budankov >> --- >> tools/lib/api/fd/array.c | 17 +++++++++-------- >> tools/lib/api/fd/array.h | 18 +++++++++++++----- >> tools/lib/perf/evlist.c | 10 +++++----- >> tools/lib/perf/include/internal/evlist.h | 2 +- >> tools/perf/tests/fdarray.c | 2 +- >> tools/perf/util/evlist.c | 2 +- >> 6 files changed, 30 insertions(+), 21 deletions(-) >> >> diff --git a/tools/lib/api/fd/array.h b/tools/lib/api/fd/array.h >> index b39557d1a88f..19b6a34aeea5 100644 >> --- a/tools/lib/api/fd/array.h >> +++ b/tools/lib/api/fd/array.h >> @@ -21,10 +21,18 @@ struct fdarray { >> int nr_alloc; >> int nr_autogrow; >> struct pollfd *entries; >> - union { >> - int idx; >> - void *ptr; >> - } *priv; >> + struct { >> + union { >> + int idx; >> + void *ptr; >> + } priv; >> + int bits; >> + } *prop; >> +}; > > why not keeping the 'priv' as a struct, like: > > struct { > union { > int idx; > void *ptr; > }; > unsigned int flags; > } *priv; > > I think we would have much less changes, also please rename bits > to flags and use some unsigned type for that Well, I supposed that priv is short for private what means the layout of struct priv object is opaque to fdarray implementation and it just passes the object as a void pointer to external callbacks (e.g in __filter()). So I preserved this semantics and wrapped and extended priv object with with flags field. It can be implemented with struct priv if you like. > >> + >> +enum fdarray_props { >> + fdarray_prop__default = 0x00000000, >> + fdarray_prop__nonfilterable = 0x00000001 >> }; > > s/fdarray_props/fdarray_flag/ Accepted. Alexey