Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2467412ybc; Sun, 24 Nov 2019 22:09:51 -0800 (PST) X-Google-Smtp-Source: APXvYqy3dZv5rSvawXhuOgAj+q3rha0MeijeUw7NqMNsdLlyvJYCDct/r+dXbGGCN6Q/gMaudsbz X-Received: by 2002:a17:906:6dcf:: with SMTP id j15mr35767062ejt.104.1574662191323; Sun, 24 Nov 2019 22:09:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574662191; cv=none; d=google.com; s=arc-20160816; b=eMQJFyMHHoeLxhBXZ1aiiosuwqq7pBvBBdCPfH4YJIBsX3pB1nuCq0cqtnDy5QeivK VT/Yr2Ga2BFAH4EIVrkrvlHY/HKN2GoFWjJWAmii1nYQwsHezsUxI+ndjCGvmJ05fp3F 0Z64chq9QO/mAMmZ7n4m88k9/2fimjppOxdCdTo90f0XS3ODidNoLYxT7+b0hiNitEfU YtUI/ipD4p1CPlhMwKlm110KW2Yn3sq+z8rmH3HP73j4XDpGsAaIcZCpnC1AERV9GTGw eQjSC0uOKmxhatnTiNm/J++H7HjGvSMhxoN3ga0+A0bW91OazC9RET9A9WfLu+Ptm42u 0vtA== 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=3XRYxENMy30+8L2glgr0feD3B3usb4HeVooFqxhtmA4=; b=YXQZSlsVdBdu4JiD6h0tcOWxQlYkIzEyRj/kjpRMEr6Ob8BEGJ/GvTEQl1OwIPwyR1 ou6nOmJzNG5O/76nMhCj2OD+fhrwpGgqgEa1DhFMMtZVuKQcYhBCxC69yGTp8OgbdqZa xawJkhh40iiWZeq2UQXX38a4BFVrWOT52pVzZ2TL15NRPgd3/ECJ1pxLVPcrgWPY9bfV d7vAa/hCH/LrZuhXueNtjkbvCl6jl9JNpW8NN69OMAiPqACa6G/APiZgci1K1j63k5f9 kWbW262sFpF6TwvSwki0+0zj3RXV91hLjyos/8n+G9+kPiHY0VH9WOUlT80YizcyT21+ Akvg== 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 a14si4567870edm.344.2019.11.24.22.09.27; Sun, 24 Nov 2019 22:09:51 -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 S1725945AbfKYGIA (ORCPT + 99 others); Mon, 25 Nov 2019 01:08:00 -0500 Received: from mga07.intel.com ([134.134.136.100]:24016 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725468AbfKYGIA (ORCPT ); Mon, 25 Nov 2019 01:08:00 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Nov 2019 22:07:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,240,1571727600"; d="scan'208";a="291273084" Received: from linux.intel.com ([10.54.29.200]) by orsmga001.jf.intel.com with ESMTP; 24 Nov 2019 22:07:59 -0800 Received: from [10.251.82.176] (abudanko-mobl.ccr.corp.intel.com [10.251.82.176]) by linux.intel.com (Postfix) with ESMTP id AE24B580577; Sun, 24 Nov 2019 22:07:57 -0800 (PST) Subject: [PATCH v2 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: Organization: Intel Corp. Message-ID: Date: Mon, 25 Nov 2019 09:07:56 +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: 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 --- Changes in v2: - capitalized MMAP_CPU_MASK_BYTES() macro --- 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..786c235d6062 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