Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2798890ybc; Mon, 25 Nov 2019 04:27:41 -0800 (PST) X-Google-Smtp-Source: APXvYqw3BHxdDmhrkb6Zh0EhbtK33GuV80DejwAfk5an9j9TkhnwFoUdmQQCbe7sVhv4ch8wfZv1 X-Received: by 2002:a05:6402:142c:: with SMTP id c12mr18151888edx.96.1574684861110; Mon, 25 Nov 2019 04:27:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574684861; cv=none; d=google.com; s=arc-20160816; b=s4wgwUSO3HAFJWYJ/3spUagvHJQlaHwoqkrVDJsgtf1BRck4HQ7u+ulaZqFrBKgnPp Zoips+hF8IjmECLsmgLSZenPsDsG463iHxJ0xjOuYEOikkqJsec7BpJbL5bldy+D/aa/ 0F2VvPHYxmo/hgngxmDzBtAnB/+a7D2+5CnBtbsxZeWJ90mJjMoVMEZpwT4yyRqnZqDY LaheZOm9uQidCX6srSFoorUpEzYIkaJM0xulEhm+EGaekcGHTpJu9ijEiUlFINre/rCv soIVjF8RSQ2rIxpvqTKNoXS4ZA8hQGS1IA0yhcTCNgb410yCgKaqdGyG3dj2fGUIGB75 juEQ== 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=z9REowE+ZYe1SOyKvoVHmlgHKcKixgsyJ7umaP8mpMI=; b=Uu50RqfeUDbNfLeh2qFB9wNsJTfdNTZvsSXN+kPDI5XKDHv7P/lUxvPF9563XUtcsW DNIQP3gfBCnHcqZa8XBHsp5DiaLau2SQKwuSwp9KTwTLzw0Le/mYSmzF4Er6KGcfF9/H fN1Mb0IT8n72Bb5LxPIw08obOOEcWNsUbF7LY3T2uGWJ/wAYQF7B1WurlJaJlsKiBKpb 0EpPdXS4SGEMWkeO/ITckGCJSqaq8vI8jVpuUC0wIQFe4T6HQ5kzfGOldJI7900wrQ53 fmVLzHGgRsNpgALqCUFt/56R6jh3LT8dmglfMC/eQXJaaFsigQT18TMdFbYa6+nPyAve sO3g== 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 f10si4439404ejq.289.2019.11.25.04.27.06; Mon, 25 Nov 2019 04:27:40 -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 S1727670AbfKYL10 (ORCPT + 99 others); Mon, 25 Nov 2019 06:27:26 -0500 Received: from mga17.intel.com ([192.55.52.151]:48311 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725851AbfKYL1Z (ORCPT ); Mon, 25 Nov 2019 06:27:25 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Nov 2019 03:27:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,241,1571727600"; d="scan'208";a="216914104" Received: from linux.intel.com ([10.54.29.200]) by fmsmga001.fm.intel.com with ESMTP; 25 Nov 2019 03:27:25 -0800 Received: from [10.125.252.215] (abudanko-mobl.ccr.corp.intel.com [10.125.252.215]) by linux.intel.com (Postfix) with ESMTP id 6662D580342; Mon, 25 Nov 2019 03:27:22 -0800 (PST) Subject: Re: [PATCH v2 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: <69bd0062-0f9e-889b-b7ef-0d97d257569b@linux.intel.com> <20191125094220.GC4675@krava> <9b9209ce-ba61-824f-9443-3909991ff222@linux.intel.com> <20191125112122.GA1201@krava> From: Alexey Budankov Organization: Intel Corp. Message-ID: <6c7de0f3-d75e-762d-f16e-10e9561c2afb@linux.intel.com> Date: Mon, 25 Nov 2019 14:27:20 +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: <20191125112122.GA1201@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 25.11.2019 14:21, Jiri Olsa wrote: > On Mon, Nov 25, 2019 at 02:13:20PM +0300, Alexey Budankov wrote: >> On 25.11.2019 12:42, Jiri Olsa wrote: >>> On Mon, Nov 25, 2019 at 09:08:57AM +0300, Alexey Budankov wrote: >>> >>> SNIP >>> >>>> -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; >>>> + >>>> if (mp->affinity == PERF_AFFINITY_NODE && cpu__max_node() > 1) >>>> build_node_mask(cpu__get_node(map->core.cpu), &map->affinity_mask); >>>> else if (mp->affinity == PERF_AFFINITY_CPU) >>>> - CPU_SET(map->core.cpu, &map->affinity_mask); >>>> + set_bit(map->core.cpu, map->affinity_mask.bits); >>>> + >>>> + return 0; >>>> } >>>> >>>> +#define MASK_SIZE 1023 >>>> int mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, int cpu) >>>> { >>>> + char mask[MASK_SIZE + 1] = {0}; >>> >>> does this need to be initialized? >> >> This is to make sure the message is zero terminated for vfprintf call() > > hum AFAICS it's used only in bitmap_scnprintf, which should > terminate the string properly If vfprintf() explicitly terminates output buffer with zero then the initialization above can be avoided. > > jirka > ~Alexey