Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1163684ybl; Tue, 3 Dec 2019 02:48:55 -0800 (PST) X-Google-Smtp-Source: APXvYqzcaL53xMHPgr1o4wpeUzXFiPtgpRuu5IWkfEpcO7Ckt4QRdNmFNTG2tH3quUJx5gC8rfs/ X-Received: by 2002:a9d:7a8a:: with SMTP id l10mr2658911otn.309.1575370135319; Tue, 03 Dec 2019 02:48:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575370135; cv=none; d=google.com; s=arc-20160816; b=bkaYVxqmHZUDYudy3Ludg/X2XzxnH6jRIuCFENdUWNXTLdG9DvlYRUMxNEEHBI1JtL GMJCWWtaHIEfKHQsE0LxqgL6yAnb4JgyTO5KvoZbAIoQo8w8dUX5ls5Te+7H94jjGAOm Ne3F64HiWZti0oVyCQF4yW95dN+hv+HQ7SPnQ8IQuWM+DPRjX+lUcAANFP6NwZ3dEDUE dSFvG7yOhMdi2qxj3nH3UK3xTP3NHl4i3v0XpxFUKipxQ5Y4UZF/pqXMUXh5O1QGm4jK Nz4w1JAHMXlBfFbElPEDVx2PyolnMlM3o4iUor6uYcJ4rv6uwD1amTdALch1jcPMjgvG 4Ydw== 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; bh=K3dIFIQJQKIPron0N4dKlx/P6hf1xyNRRdaJ4hmW2a0=; b=nrpSiBLAOEu4c1eaZps/MvY9kAESPZnxH+YbHPwHszMw+YQ0RN44BrS04uSZ5od9NH kEv+amKu4DuFAT9wI6tsaXYBWfyRxMcwbCA1lgzM8kRZdUiA9KMgZHi0ObwJS8CV4esR 551pBW01JNiglt+5GHyvopS9jKDxNc+MhqXUvbZiXhtQufqppIINk2WjoqqNlOrkwl01 NRwvjCCwF7iG/3deZ1fokitVHqdDodFxYSQa1WDlmdPMRE/FCxKXpd8UzKIQOWpVidjE Nyyqwl3C48/ePJwVlUYYeHszbqxZMqFnSlLE1Vai77RFHIJhjxciKDT+P7m5bMjRa/zc xU+w== 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 17si1068879oiz.202.2019.12.03.02.48.42; Tue, 03 Dec 2019 02:48:55 -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 S1726189AbfLCKsL (ORCPT + 99 others); Tue, 3 Dec 2019 05:48:11 -0500 Received: from mga03.intel.com ([134.134.136.65]:10649 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725829AbfLCKsL (ORCPT ); Tue, 3 Dec 2019 05:48:11 -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 orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Dec 2019 02:48:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,272,1571727600"; d="scan'208";a="293758935" Received: from linux.intel.com ([10.54.29.200]) by orsmga001.jf.intel.com with ESMTP; 03 Dec 2019 02:48:10 -0800 Received: from [10.125.253.16] (abudanko-mobl.ccr.corp.intel.com [10.125.253.16]) by linux.intel.com (Postfix) with ESMTP id 3A5195802BC; Tue, 3 Dec 2019 02:48:08 -0800 (PST) Subject: Re: [PATCH v4 3/3] perf record: adapt affinity to machines with #CPUs > 1K To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Andi Kleen , linux-kernel References: <2095b034-bf53-c374-0e34-adc006b00fbb@linux.intel.com> <20191203101252.GD17468@krava> From: Alexey Budankov Organization: Intel Corp. Message-ID: Date: Tue, 3 Dec 2019 13:48:05 +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: <20191203101252.GD17468@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 03.12.2019 13:12, Jiri Olsa wrote: > On Mon, Dec 02, 2019 at 09:58:48AM +0300, Alexey Budankov wrote: > > SNIP > >> >> -static void build_node_mask(int node, cpu_set_t *mask) >> +static void build_node_mask(int node, struct mmap_cpu_mask *mask) >> { >> int c, cpu, nr_cpus; >> const struct perf_cpu_map *cpu_map = NULL; >> @@ -240,17 +242,23 @@ static void build_node_mask(int node, cpu_set_t *mask) >> for (c = 0; c < nr_cpus; c++) { >> cpu = cpu_map->map[c]; /* map c index to online cpu index */ >> if (cpu__get_node(cpu) == node) >> - CPU_SET(cpu, mask); >> + set_bit(cpu, mask->bits); >> } >> } >> >> -static void perf_mmap__setup_affinity_mask(struct mmap *map, struct mmap_params *mp) >> +static int perf_mmap__setup_affinity_mask(struct mmap *map, struct mmap_params *mp) >> { >> - CPU_ZERO(&map->affinity_mask); >> + map->affinity_mask.nbits = cpu__max_cpu(); >> + map->affinity_mask.bits = bitmap_alloc(map->affinity_mask.nbits); >> + if (!map->affinity_mask.bits) >> + return -1; > > hum, this one should be also behind (rec->opts.affinity != PERF_AFFINITY_SYS) > condition, right? sry I haven't noticed that before.. That has not been so far, but, probably like this: diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c index 7f573f646431..832d2cb94b2c 100644 --- a/tools/perf/util/mmap.c +++ b/tools/perf/util/mmap.c @@ -269,7 +269,8 @@ int mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, int cpu) return -1; } - if (perf_mmap__setup_affinity_mask(map, mp)) { + if (mp->affinity != PERF_AFFINITY_SYS && + perf_mmap__setup_affinity_mask(map, mp)) { pr_debug2("failed to alloc mmap affinity mask, error %d\n", errno); return -1; Thanks, Alexey