Received: by 2002:a17:90a:88:0:0:0:0 with SMTP id a8csp201937pja; Fri, 22 Nov 2019 05:24:28 -0800 (PST) X-Google-Smtp-Source: APXvYqy51Eza6AZIyl1HBDHx7mcslGdLUm+2hQl26VDk40AdBlQk7seTf0hOX4ajmGAXBoVK6D20 X-Received: by 2002:a50:91d0:: with SMTP id h16mr1028560eda.203.1574429068775; Fri, 22 Nov 2019 05:24:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574429068; cv=none; d=google.com; s=arc-20160816; b=PsIr9kS1BQCXoerNc0U7q4t+yOGY2l16SoLqsEeNwd579KEBjQ/zWA+hNoCzAIIxgl oUsMGjLw8IF/FwrNUIZ0BAeyBbB4Sdee/Mh1hwaOz0Zrlw/1/4lzaLKhm0yc3t+vuDs0 cMQuaRJw43ldD4DaVPWCNWYT86aDu32SmY4Y+wIgHhDYfKA9I74AuUtYLa4FpUcM27g9 VR4e88hj47FXFP/8Lb4qacp0BF0tJc6aaizW/yX7pW1UBH9xKr0itEOAy+aPI038jyMi SfGR/3T5Ch/cEv1wLEzsacFoDYPpGk0DJ4E3Dgo8mkqnb1aCXydW13FTpBqzrFQGLOWw DHQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:user-agent:in-reply-to:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+4wnR7dCvlIXj37ch8LQ+LBMc9e941hqLYJ5YiYY/54=; b=g0SDOdUqZs2ygn26Nr1p4xfvNXDey93aiQBoKwEk4F/v4qHWOJPj1eZwqOPV0JlNDq PhbAjgp4WmXUxdBJpf6oS1mZo5K77+k5d/GxhdGD5STsvD7iiV0S4u7Vi2IRO95t/YJL YgcrEDkKyznYImVSQRMPTmMK6SFvfU7wKMiNJSDSjmL4SUAC/X5XHCsQ6qqZWCy65y4r 9eL4+1kmBQ6wITpr5uexPpAzxbvJUVgfZkNPWfyBs4qP6vO7/CDs3pdbE2cIbqi/mXZj g01hMAqcgy7N4LPmHMUdSqtaqkVhT0KeZ2wm9uNreeHUSnyIT7IjIAmsbmoh3sZYrSLP XrkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EExNY+FM; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d13si1047105edv.97.2019.11.22.05.24.04; Fri, 22 Nov 2019 05:24:28 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EExNY+FM; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727207AbfKVNWg (ORCPT + 99 others); Fri, 22 Nov 2019 08:22:36 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:46883 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726548AbfKVNWf (ORCPT ); Fri, 22 Nov 2019 08:22:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574428954; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+4wnR7dCvlIXj37ch8LQ+LBMc9e941hqLYJ5YiYY/54=; b=EExNY+FM7cHvRoF2+plNATcZW42dKZSC1HiyRK77MVjAd4nZxtXvN0gWIldlnL/V8iYRVi /r3CGIhFNWib1iB5g37pFiqH/D/DtH90kmKLXm1b//ILIRGR/YjAr9yaqDqBaVz2zQMreu Oftn3GtG87M1+KEEnNbsps/Y+gqaCr4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-365-t0HIDd_wN9ys9txeJAhyvw-1; Fri, 22 Nov 2019 08:22:31 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 06DD010054E3; Fri, 22 Nov 2019 13:22:30 +0000 (UTC) Received: from krava (unknown [10.40.205.117]) by smtp.corp.redhat.com (Postfix) with SMTP id 047141A8D9; Fri, 22 Nov 2019 13:22:26 +0000 (UTC) Date: Fri, 22 Nov 2019 14:22:26 +0100 From: Jiri Olsa To: Alexey Budankov Cc: Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Andi Kleen , linux-kernel Subject: Re: [PATCH v1 3/3] perf record: adapt affinity to machines with #CPUs > 1K Message-ID: <20191122132226.GF17308@krava> References: <26d1512a-9dea-bf7e-d18e-705846a870c4@linux.intel.com> <2561f736-bdb5-a10a-1a5d-590ad499ce49@linux.intel.com> MIME-Version: 1.0 In-Reply-To: <2561f736-bdb5-a10a-1a5d-590ad499ce49@linux.intel.com> User-Agent: Mutt/1.12.1 (2019-06-15) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: t0HIDd_wN9ys9txeJAhyvw-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 20, 2019 at 12:38:57PM +0300, Alexey Budankov wrote: SNIP > diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c > index 063d1b93c53d..070b1873cd45 100644 > --- a/tools/perf/util/mmap.c > +++ b/tools/perf/util/mmap.c > @@ -23,6 +23,7 @@ > #include "mmap.h" > #include "../perf.h" > #include /* page_size */ > +#include > =20 > size_t mmap__mmap_len(struct mmap *map) > { > @@ -215,7 +216,7 @@ void mmap__munmap(struct mmap *map) > =09auxtrace_mmap__munmap(&map->auxtrace_mmap); > } > =20 > -static void build_node_mask(int node, cpu_set_t *mask) > +static void build_node_mask(int node, struct mmap_cpu_mask *mask) > { > =09int c, cpu, nr_cpus; > =09const struct perf_cpu_map *cpu_map =3D NULL; > @@ -228,28 +229,43 @@ static void build_node_mask(int node, cpu_set_t *ma= sk) > =09for (c =3D 0; c < nr_cpus; c++) { > =09=09cpu =3D cpu_map->map[c]; /* map c index to online cpu index */ > =09=09if (cpu__get_node(cpu) =3D=3D node) > -=09=09=09CPU_SET(cpu, mask); > +=09=09=09set_bit(cpu, mask->bits); > =09} > } > =20 > -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) > { > -=09CPU_ZERO(&map->affinity_mask); > +=09map->affinity_mask.nbits =3D cpu__max_cpu(); > +=09map->affinity_mask.bits =3D bitmap_alloc(map->affinity_mask.nbits); > +=09if (!map->affinity_mask.bits) > +=09=09return 1; I guess this works, but please return < 0 on error thanks, jirka