Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3212104imm; Sun, 24 Jun 2018 14:32:09 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLFuJ8eZgdr1x4zz6dS7wqIOmWqo77hWE78Bnb6pNik62JORf1YALj5VXxYZfi15eW/jLZY X-Received: by 2002:a17:902:d24:: with SMTP id 33-v6mr10036062plu.22.1529875929399; Sun, 24 Jun 2018 14:32:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529875929; cv=none; d=google.com; s=arc-20160816; b=bEiS3dXVxcrW/W8eW1JzaESR7Rck0rtSvQHTU7OWukJvEnHBoBYWkzQU407CV69k4g a6/Yn0V1dQCg7wueGkKRG0rB43vyY04jwhfdxQPhR4r4bu7SOMEN2uyN7/UzJ7W5ftKz M/Se5KXNRaZc2MFjSwCeKujKVfxdkG1rG+lKqhivN807f2VbgBZeQ2VQWVE8wQozgOx7 ZAtukHH7EQ5Nb9uYhF2kNIBqSpyVrnnbuKm95joOF+ZKZ3znABZOZjJCyuuHVoo2eGvv /cP0iF3qts/V3bfqIUMapwYH27IPv+GKQP85G4y1eX4rVzElOT01gj76zDJahRbS8h0C +/ng== 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=7Rjru6uP5cOfGN16NdDJ2Ndmvv1oF1kIKQ/4/S2ClKE=; b=XludLR5X1mkrVMzuoY1ja8bSUVudVyq+vbDgjlnq/xjP6v4clmGKqhuAQQB2SVAI+Q iZHtkqs0bQFGuhZ0wVuC60Qp3MrG713PWBanuTOXuptLIKqyacMpR8/zUtUsCB7jPYmn dLJG27sx19LnSMjSmBtXmWmJTHAW+S93buq64k0vr3PAi6NMw/T9UkfDFgHxmo/qcK2L r3uelBOoSEOJRC/hzX05C29opzpAv6jBbQ8KqMEE3HW9/aHG/d6KoRROB23NZKGAitRh OjCa/zuxNHu7DVjGkSzqZZspmR7ZYEAH8rtrIZOrFK21RN0Fn0Zzvg23DW87XvBxOFXr UM+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gSNFt2j3; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 22-v6si12819907pfh.308.2018.06.24.14.31.54; Sun, 24 Jun 2018 14:32:09 -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=@gmail.com header.s=20161025 header.b=gSNFt2j3; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752044AbeFXVbJ (ORCPT + 99 others); Sun, 24 Jun 2018 17:31:09 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:35793 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751858AbeFXVbH (ORCPT ); Sun, 24 Jun 2018 17:31:07 -0400 Received: by mail-pg0-f66.google.com with SMTP id i7-v6so5164426pgp.2 for ; Sun, 24 Jun 2018 14:31:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=7Rjru6uP5cOfGN16NdDJ2Ndmvv1oF1kIKQ/4/S2ClKE=; b=gSNFt2j37t7Rem6rZgA5m0lkxDpcG3nZv5JJFiQYlWG04eHrqc17S6ECmJKaybt5Cn yL7BVfgMe1tQ5rsHUep5ps0AttnXz15tOenhJzPy4x0+PZb4ZAMTjPT+8szQCuiMZSjR 5OCDYvMmlUP3qz5qp9oGSipJMduPkI63IZSaIMSLnFnN72GwoxxyOYq/GG76iZL89bxA bPU6oExhJ6jYYJFB7BJNMvbkgvHhMjAoiV7gPV0cOk8KyNc7S8MATRptZYnKg3QYzcT+ WesidSMD8feBgjAM0t6GipaMBpqOpX5eyjxcOH2BXW9wC3SqrY/Ey9n5ScFlSoktoRYU NMIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=7Rjru6uP5cOfGN16NdDJ2Ndmvv1oF1kIKQ/4/S2ClKE=; b=qsn30oKLW1mpAxJvAt/LDz20tZsv3WAaGNnVpMJyOCLFim4bOHd7K7/ImjGYVByQw4 JmN+Wvi5+AmkbIcrd2aNrjlfUHXi7be5yTwUUIbdOu2tIQhcxELJeDWsyu/TnuLyklT4 IJRipi9T/ueCG5EULa5DUkRlad0oOPKrS2TGQvn2BoX4tZe3o1npz64pN4fcmHRhf6+Q Gkg/X+fIrgJOl2UyK7H9X9v0AScbbkBT7QBIiHc56kv/lT8dc6CnqOrxB+3XcBaxc1PV tlZEE/wcNFuR9LtgvYalTES8VUlsXRj4m3dHNlmaPXK+y+OobGYseJyKx6K5MMbGGQQQ CVOw== X-Gm-Message-State: APt69E0UHp7rFzLCvnt3Z2nyAGElyuckl93ib31ogq2O3JUuGgJbNNwL o+j6a/eWQSiLVG4JxEjkmRUCCE6j X-Received: by 2002:a63:a543:: with SMTP id r3-v6mr7819399pgu.336.1529875866713; Sun, 24 Jun 2018 14:31:06 -0700 (PDT) Received: from dtor-ws ([2620:0:1000:1511:8de6:27a8:ed13:2ef5]) by smtp.gmail.com with ESMTPSA id o12-v6sm7896621pgs.52.2018.06.24.14.31.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 24 Jun 2018 14:31:05 -0700 (PDT) Date: Sun, 24 Jun 2018 14:31:03 -0700 From: Dmitry Torokhov To: Yury Norov Cc: Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , 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 , Andrew Morton , Mike Snitzer Subject: Re: [PATCH 2/2] bitmap: sync tools with new bitmap allocation API Message-ID: <20180624213103.GA166241@dtor-ws> References: <20180623073502.16321-1-ynorov@caviumnetworks.com> <20180623073502.16321-2-ynorov@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180623073502.16321-2-ynorov@caviumnetworks.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 On Sat, Jun 23, 2018 at 10:35:02AM +0300, Yury Norov wrote: > On top of next-20180622 and Andy Shevchenko series: > https://lkml.org/lkml/2018/6/18/841 > > The series mentioned above introduces helpers for bitmap allocation. > tools/ has its own bitmap_alloc() which differs from bitmap_alloc() > proposed in new kernel API, and is equivalent to bitmap_zalloc(). > In this series tools is switched to new API. > > This is RFC because I didn't find counterpart free() call to some > bitmap_zalloc()'s. So I didn't convert them to bitmap_free(). Could > someone point me out? The functions are: > setup_nodes(); > do_read_bitmap(); // Free is called, but only in fail path. Yes, because if we succeed we effectively return allocated bitmap to the caller. You'd need to trace upwards and see how it all gets cleaned up. But given that this is userspace and is not expected to be long-lived, maybe nobody bothered freeing memory and we instead rely on the kernel to clean it all up when process terminates. Thanks. > memory_node__read(); > > Signed-off-by: Yury Norov > --- > tools/include/linux/bitmap.h | 19 +++++++++++++++---- > tools/perf/builtin-c2c.c | 10 +++++----- > tools/perf/tests/bitmap.c | 4 ++-- > tools/perf/tests/mem2node.c | 4 ++-- > tools/perf/util/header.c | 6 +++--- > 5 files changed, 27 insertions(+), 16 deletions(-) > > diff --git a/tools/include/linux/bitmap.h b/tools/include/linux/bitmap.h > index 48c208437bbd..b9b85b94c937 100644 > --- a/tools/include/linux/bitmap.h > +++ b/tools/include/linux/bitmap.h > @@ -98,12 +98,23 @@ static inline int test_and_set_bit(int nr, unsigned long *addr) > } > > /** > - * bitmap_alloc - Allocate bitmap > - * @nbits: Number of bits > + * Allocation and deallocation of bitmap. > */ > -static inline unsigned long *bitmap_alloc(int nbits) > +static inline unsigned long *bitmap_alloc(unsigned int nbits, gfp_t flags) This makes absolutely no sense for userspace API. What gfp_t even means here? If you want to introduce bitmap_zalloc and bitmap_free it is fine but adding dummy parameters to match kernel API exactly is a folly. Thanks. -- Dmitry