Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1814771ybc; Wed, 20 Nov 2019 04:38:12 -0800 (PST) X-Google-Smtp-Source: APXvYqyJPJS+kplOQxa4AtKDNCyJQUKLWPFoED42t/M5lgV44d8UeSYavRGtifbKgONJ45parPGV X-Received: by 2002:a17:906:301a:: with SMTP id 26mr5115794ejz.201.1574253492183; Wed, 20 Nov 2019 04:38:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574253492; cv=none; d=google.com; s=arc-20160816; b=j70z+KhChiI/EPDn3iuhogiPyzvBJsnEo393swSItSBX3o2XLEyltMQLQBjXHT1Hx5 Dvmp5eMv8D/lIS5GQe912VgZTTtBzZ/cp6xUoSsta3mf0jsDJ6/cNvuQ/nQcur+ue7Fl ZM7SBEevOlzdaW4Gthau8RLAxvUEGla3T7wpOPhctSoxIYziZk/5eGSAjMwFhfBuWdtw gv7ByhYFnLJpoUZ9rk8bxEraO8OsoW6T1pF65TqeSdTMdgAB5lf0/TqZdWdN6Yn1x8VR XaK+Xt68PBJOieOxHJYXEn87cyYT8cFtPDtlr5PlReODiImGkUOUEu73oCNHbDTc1/t/ FrEw== 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:references:cc:to:from:subject; bh=+XsnscgWv/Y66qd3N3sv923fyy0OQa50w2aVnuySwHk=; b=sDXjm4RIiXWZKQlQN4J9A1kXm7S6GuJx3nT2a1OzXMcKTCWPajG5DH2ue/zih8pLV8 kObt+Lkbt6wzEIHO02sfcuzmms6p5HamHi/j1eGcEoHYwF5jD/Hn7RDIPHYkoF4AFO3k o84h2D+b+uVloR3b4oWGeVKuwDBESY/xcco4xj4rf40JrbW5QfsMmraBJxK4F1RUpnVR R0Beo6sRhW6AJLt4HJ8vYvxDmlE6M0iSVOpYSmz/fYU/zzEqRF0mDP9U/yB2OO+oHt8I ObbFFAECV0vtij14UHfUSI5iTCD03uRnZmt4b2o/HDlnS8mCSxBrO5d1lbznRVtl2pk4 IJ3A== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g24si7271138ejb.89.2019.11.20.04.37.48; Wed, 20 Nov 2019 04:38:12 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728337AbfKTJhx (ORCPT + 99 others); Wed, 20 Nov 2019 04:37:53 -0500 Received: from mga18.intel.com ([134.134.136.126]:26849 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727645AbfKTJhx (ORCPT ); Wed, 20 Nov 2019 04:37:53 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Nov 2019 01:37:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,221,1571727600"; d="scan'208";a="231868218" Received: from linux.intel.com ([10.54.29.200]) by fmsmga004.fm.intel.com with ESMTP; 20 Nov 2019 01:37:52 -0800 Received: from [10.249.33.94] (abudanko-mobl.ccr.corp.intel.com [10.249.33.94]) by linux.intel.com (Postfix) with ESMTP id F2F9B5802E4; Wed, 20 Nov 2019 01:37:49 -0800 (PST) Subject: [PATCH v1 2/3] perf mmap: declare type for cpu mask of arbitrary length From: Alexey Budankov To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Andi Kleen , linux-kernel References: <26d1512a-9dea-bf7e-d18e-705846a870c4@linux.intel.com> Organization: Intel Corp. Message-ID: <0c716b33-a91e-2972-637f-e7c3a187fa77@linux.intel.com> Date: Wed, 20 Nov 2019 12:37:48 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <26d1512a-9dea-bf7e-d18e-705846a870c4@linux.intel.com> 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 Declare a dedicated struct map_cpu_mask type for cpu masks of arbitrary length. Mask is available thru bits pointer and the mask length is kept in nbits field. mmap_cpu_mask_bytes() macro returns mask storage size in bytes. Signed-off-by: Alexey Budankov --- tools/perf/util/mmap.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/perf/util/mmap.h b/tools/perf/util/mmap.h index bee4e83f7109..a218a0eb1466 100644 --- a/tools/perf/util/mmap.h +++ b/tools/perf/util/mmap.h @@ -15,6 +15,15 @@ #include "event.h" struct aiocb; + +struct mmap_cpu_mask { + unsigned long *bits; + size_t nbits; +}; + +#define mmap_cpu_mask_bytes(m) \ + (BITS_TO_LONGS(((struct mmap_cpu_mask *)m)->nbits) * sizeof(unsigned long)) + /** * struct mmap - perf's ring buffer mmap details * -- 2.20.1