Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp675368imm; Wed, 25 Jul 2018 04:21:22 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcqD51WUVqUQLuxkOgvgddpI4EP7lC7mJCW2Sjh2pPcKqPcjKLg+AD35F/9nAJJ7Jl3JSC2 X-Received: by 2002:a17:902:a40b:: with SMTP id p11-v6mr20796165plq.228.1532517682342; Wed, 25 Jul 2018 04:21:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532517682; cv=none; d=google.com; s=arc-20160816; b=Tgyw4Ao8cX9MxRJuUH2lmCgfh9G7PedBe2Kr1QY67yVuSvH17Coptq7HwOO4ceOALd cCicbPP65c28goP+i2e3SqncLpE9kclTnHZdHa18RFh0OM7TAQ7JZvKuH93IazG1ZbbP 1betYW/CZlIOcTraWnkfc77u+pcVyGf5lwf6o5sph57Z4CVJiBjHGyfXfVWTDMs16/Zl MAO3OHj2R6aP68yOAJgP/RQKHKjoqEB1AKGj8PtEjX7Jgvr2BTDDAiqiOpY1VMp8B1xC z7l/baTXGliYtecNk/uNXO4GKKhVL77mbZ9GHS2HwOwZEUrzEHVG8R43J76mpvAKE9LT /lfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=u43x2jLhR47EyM61j3B8+5avdxBU37SqqrO1Nw+UsQM=; b=fUKrgz0ILgrqnvkKYPwrwJmI+FsV2zhVxrpTeqz/1s3rGbtkkcrKu63BH+Yrncyz/l NORKqV91WVfZIuOPBq8fKaAEQW5iURrEJ/ufHnOH28wgwS2LsHlF/OulHSVLkyE/Q4tF NqEZaMjrV3N8alxbhLqWsHawNReLJpt7isxC02Yf9JIi+aRFMhJCQt68ERdGxwwMpWbs twxEDHor73sT8Zm+M46xnYHsITepavtOZKd3rKpQtbprRE5I20hSukXod0/gtrPjQuLG rVX+OC5iqSfVGVCVQbmzXIf8ib5QZSqjtbciWi/oLHhw7CbTxyfw+/iqtsnrqNHBcdIL jDCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fA4uIp7Z; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 68-v6si12891693pga.113.2018.07.25.04.21.07; Wed, 25 Jul 2018 04:21:22 -0700 (PDT) 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=@kernel.org header.s=default header.b=fA4uIp7Z; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728689AbeGYMbQ (ORCPT + 99 others); Wed, 25 Jul 2018 08:31:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:36794 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728354AbeGYMbQ (ORCPT ); Wed, 25 Jul 2018 08:31:16 -0400 Received: from jouet.infradead.org (unknown [179.97.41.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 094EC20844; Wed, 25 Jul 2018 11:20:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1532517603; bh=13XUri3/wi88o6Umh1nW322tYhaWseUDVKuc81fIO44=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fA4uIp7ZDQg6YH2+jqyXX8u8mBiE5FrJaKJXXWJnx/Hw7m5tP6d1ywcCAgngPMgsk Bp2hYQ7LasD4sNIoxBLWOpKEaxRgkmOCpN07eoiS8vvsZhAoZWS/sQaci6IyDGePun GsOy02Ar+SEoAzaeKpItRol8A5gJv0hmj7FDmorY= Received: by jouet.infradead.org (Postfix, from userid 1000) id 8DFB81403B8; Wed, 25 Jul 2018 08:20:00 -0300 (-03) Date: Wed, 25 Jul 2018 08:20:00 -0300 From: Arnaldo Carvalho de Melo To: Yury Norov Cc: Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Jiri Olsa , Namhyung Kim , Kate Stewart , Matthew Wilcox , Philippe Ombredanne , David Ahern , David Carrillo-Cisneros , Andi Kleen , Jin Yao , linux-kernel@vger.kernel.org, Andy Shevchenko , Dmitry Torokhov , Andrew Morton , Mike Snitzer Subject: Re: [PATCH 1/2] perf: drop unneeded bitmap_zero() in util/header.c Message-ID: <20180725112000.GI13220@kernel.org> References: <20180623073502.16321-1-ynorov@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180623073502.16321-1-ynorov@caviumnetworks.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Sat, Jun 23, 2018 at 10:35:01AM +0300, Yury Norov escreveu: > On top of next-20180622. > > bitmap_zero() is called after bitmap_alloc() in perf code. But > bitmap_alloc() internally uses calloc() which guarantees that allocated > area is zeroed. So following bitmap_zero is unneeded. Drop it. > > This happened because of confusing name for bitmap allocator. It > should has name bitmap_zalloc instead of bitmap_alloc. This series: > https://lkml.org/lkml/2018/6/18/841 > introduces new API for bitmap allocations in kernel, and functions > there are named correctly. Following patch propogates the API to tools, > and fixes naming issue. > > Signed-off-by: Yury Norov > --- > tools/perf/tests/bitmap.c | 2 -- > tools/perf/tests/mem2node.c | 5 +---- > tools/perf/util/header.c | 3 --- > 3 files changed, 1 insertion(+), 9 deletions(-) > > diff --git a/tools/perf/tests/bitmap.c b/tools/perf/tests/bitmap.c > index 47bedf25ba69..96e7fc1ad3f9 100644 > --- a/tools/perf/tests/bitmap.c > +++ b/tools/perf/tests/bitmap.c > @@ -16,8 +16,6 @@ static unsigned long *get_bitmap(const char *str, int nbits) > bm = bitmap_alloc(nbits); > > if (map && bm) { > - bitmap_zero(bm, nbits); > - > for (i = 0; i < map->nr; i++) > set_bit(map->map[i], bm); > } > diff --git a/tools/perf/tests/mem2node.c b/tools/perf/tests/mem2node.c > index 0c3c87f86e03..d8e3d49d3638 100644 > --- a/tools/perf/tests/mem2node.c > +++ b/tools/perf/tests/mem2node.c > @@ -24,11 +24,8 @@ static unsigned long *get_bitmap(const char *str, int nbits) > bm = bitmap_alloc(nbits); > > if (map && bm) { > - bitmap_zero(bm, nbits); > - > - for (i = 0; i < map->nr; i++) { > + for (i = 0; i < map->nr; i++) > set_bit(map->map[i], bm); > - } > } Please refrain from doing unrelated changes to the purpose of the patch, that just gets in the way of reviewing, i.e. what for removing those braces? The patch should be just: @@ -24,6 +24,7 @@ static unsigned long *get_bitmap(const char *str, int nbits) bm = bitmap_alloc(nbits); if (map && bm) { - bitmap_zero(bm, nbits); for (i = 0; i < map->nr; i++) { Because the point of this patch is just to remove this unneeded bitmap_zero(). > > if (map) > diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c > index 540cd2dcd3e7..3a6bec22baa3 100644 > --- a/tools/perf/util/header.c > +++ b/tools/perf/util/header.c > @@ -279,8 +279,6 @@ static int do_read_bitmap(struct feat_fd *ff, unsigned long **pset, u64 *psize) > if (!set) > return -ENOMEM; > > - bitmap_zero(set, size); > - > p = (u64 *) set; > > for (i = 0; (u64) i < BITS_TO_U64(size); i++) { > @@ -1285,7 +1283,6 @@ static int memory_node__read(struct memory_node *n, unsigned long idx) > return -ENOMEM; > } > > - bitmap_zero(n->set, size); > n->node = idx; > n->size = size; > > -- > 2.17.1