Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp8069146ybc; Fri, 29 Nov 2019 05:12:54 -0800 (PST) X-Google-Smtp-Source: APXvYqykRs5WS5nJwXs7F6KDmemgYEeQQfrVWqdmkyLaYEFW7vhcq/+Vq80m39uQ3Vucr0lx4hB1 X-Received: by 2002:a17:906:4899:: with SMTP id v25mr60473797ejq.235.1575033173826; Fri, 29 Nov 2019 05:12:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575033173; cv=none; d=google.com; s=arc-20160816; b=UblBV7AFT8G3CeBfnltTK2KT8FhuSYvlQ9GZpXsb+pnkdPKi6t/bPjdtgfjHXTX+M5 ZbRc6yv1F2C6Ln0P9TjDh7X5KDvH5XQRYfsQJnudO34YAtlrOLVUE3Q6xziza0N7ggur aKFPrVgcCGtyMGxPJ0QfmQ3QkmpcRHA+Fg8W1OJzgIPuvv7DY7Sgv4juXbeIMT1nxF6+ UQk8rVTuJ+U23oWuuvwd3Mv6P0ZY8xb6GrKD7V6wIrSHIXNxV0CCAep77SAAIUh+YHcl wy1Q1fV8aGwSpBzHgkyKbUaEIXspOLAWgXClKeicjhbChEATVN9/z3bsMRvqQi4Mn/CS 4OSQ== 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=WnNpUelcmW1Zzw18d7Esh4Fn0UgHM+vp8eNsllmWrUk=; b=N/Y0o9rGntxeSwHZJ2ZuFaooCMdxbXBc078WKwE2/PesZTCNPPOy5jetU3LKGNLssH R52TeMOSq1Qb3bycAIV/j4E02aOQTRfhiZ+t2iClZB8CWeaSWFr7UWywxXIAJvr5O9YT YQIVcRY7u//40IccQDZich9cW+OGCCeAqQZIKl4xQE/Td6jrNMoyVB7czgqBwsDDOGCF oFHXZ5YmWwliqPGAYLeecKcbf9Qj3RFr3ncfUvqNTgPoE754HENYYq6LwnGQXBQSxoeU e1gDe6yuMYA1DjvdZzLBMsbyqxL0NZk25BHHNa9eVvUo0NUcEnCGiT4RUiMEqCul0l8W eV3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hHBuoohL; 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 nw21si13483730ejb.222.2019.11.29.05.12.21; Fri, 29 Nov 2019 05:12:53 -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=hHBuoohL; 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 S1726824AbfK2NHT (ORCPT + 99 others); Fri, 29 Nov 2019 08:07:19 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:28046 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726360AbfK2NHS (ORCPT ); Fri, 29 Nov 2019 08:07:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575032837; 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=WnNpUelcmW1Zzw18d7Esh4Fn0UgHM+vp8eNsllmWrUk=; b=hHBuoohLN8j8+ERv8FM8BePppTXgWcR61yyE7WLp3vm3QcvomDkWHnv3n3IA1MQrd+BGwx jPshrpq1bUsBOBhdgLe+yVD4ZvQTfDHTtPDC53tc7CzJGUkfOzHnZBaSrBYEo9Y+RFskU4 MtRU9DzbeR0SIkizd89fl0lbvIYHWhU= 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-340-htrLZBNQNJmWighpj58W8Q-1; Fri, 29 Nov 2019 08:07:14 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 33559911A5; Fri, 29 Nov 2019 13:07:13 +0000 (UTC) Received: from krava (unknown [10.43.17.48]) by smtp.corp.redhat.com (Postfix) with SMTP id 94349608C9; Fri, 29 Nov 2019 13:07:11 +0000 (UTC) Date: Fri, 29 Nov 2019 14:07:10 +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 v3 3/3] perf record: adapt affinity to machines with #CPUs > 1K Message-ID: <20191129130710.GB14169@krava> References: <908dbe98-7d8d-0ec1-d4ae-242f3e104979@linux.intel.com> <21bc3ad7-e1f2-68da-f004-36354a6e40ea@linux.intel.com> MIME-Version: 1.0 In-Reply-To: <21bc3ad7-e1f2-68da-f004-36354a6e40ea@linux.intel.com> User-Agent: Mutt/1.12.1 (2019-06-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: htrLZBNQNJmWighpj58W8Q-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=us-ascii 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 Fri, Nov 29, 2019 at 01:05:26PM +0300, Alexey Budankov wrote: SNIP > # undef REASON > #endif > =20 > -=09CPU_ZERO(&rec->affinity_mask); > =09rec->opts.affinity =3D PERF_AFFINITY_SYS; > =20 > =09rec->evlist =3D evlist__new(); > @@ -2499,6 +2504,14 @@ int cmd_record(int argc, const char **argv) > =20 > =09symbol__init(NULL); > =20 > +=09rec->affinity_mask.nbits =3D cpu__max_cpu(); > +=09rec->affinity_mask.bits =3D bitmap_alloc(rec->affinity_mask.nbits); > +=09if (!rec->affinity_mask.bits) { > +=09=09pr_err("Failed to allocate thread mask for %ld cpus\n", rec->affin= ity_mask.nbits); > +=09=09return -ENOMEM; > +=09} > +=09pr_debug2("thread mask[%ld]: empty\n", rec->affinity_mask.nbits); above can be done only for (rec->opts.affinity !=3D PERF_AFFINITY_SYS) > + > =09err =3D record__auxtrace_init(rec); > =09if (err) > =09=09goto out; > @@ -2613,6 +2626,8 @@ int cmd_record(int argc, const char **argv) > =20 > =09err =3D __cmd_record(&record, argc, argv); > out: > +=09if (rec->affinity_mask.bits) > +=09=09bitmap_free(rec->affinity_mask.bits); > =09evlist__delete(rec->evlist); > =09symbol__exit(); > =09auxtrace_record__free(rec->itr); > diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c > index 30ff7aef06f2..615d05870849 100644 > --- a/tools/perf/util/mmap.c > +++ b/tools/perf/util/mmap.c > @@ -219,6 +219,9 @@ static void perf_mmap__aio_munmap(struct mmap *map __= maybe_unused) > =20 > void mmap__munmap(struct mmap *map) > { > +=09if (map->affinity_mask.bits) > +=09=09bitmap_free(map->affinity_mask.bits); you don't need to check map->affinity_mask.bits, it's checked in free jirka