Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3944152imm; Mon, 25 Jun 2018 07:13:46 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLrGv+ypILWZKud3xNhA0SQ5Dk3pE81G0pzI/6FggG2y1hbHlv9xk8DLD4rSkAfVDm+ku+O X-Received: by 2002:a17:902:9690:: with SMTP id n16-v6mr12570465plp.94.1529936026130; Mon, 25 Jun 2018 07:13:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529936026; cv=none; d=google.com; s=arc-20160816; b=Gt5nZmY/sKu52zvJcL3yhpxVDoK8fuX/HzDiMm27UnzJeJOyyt/z10wn2ekrBicfbV 7Dc0yf49mEoEqGbVuvTVVYMu/GT4xgL6SnvMHMNyqvrJ6YAJCzMoFWxSSxsedaqGyhKg GI2Eh33mNUym3gCfEVBKB+stfXTlvekN8A9cEFk3YE/tLst2bpcpaokLsWhpUUV/6MAf hvUOxV5d6SDYcnqHP1ouVobm6sS+QZeOPty7GjdD9TNl5cZcGUHeFIC9MoPuvugT4wbI 5uAFb9e66o48bBbks7TwtcwHextD3+tziFBFdYCnkPiLp6PnOcQy6nZ7vM/Ul/ImPq1B JPpw== 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=twumzrQpJ2xX7t1Vcuk/SX/AnUteSE0BrBE3sZ2rOvs=; b=qZUvxkwX4lnDyyk0CGlQs8VayYFOUh6sZ5NJtabD28JGa0AawpmhsCRiNIKrEZPu5C 20/3pjETuiFw8WsrrSAuuH+1U5cozm+vhO5PNiaU8U2k4vqzUDZ7Z39c9C81tBpy217M 5+mX/FTyiAQS+phH7NOn6V5V88hLym0Uwd4UiNBNhay8Z/A8DV8yRi4nVl2KYAVyGNk2 5IIPmMjmfKTQ6L1p09Q2OcSaEc8+Sg5gMQmWayBPki4EQxgK5kKKCyNrewmI5Yc2qG3u 2NQS/t+8MtPcdlNwqq+OjZgOHGfvIhi5j9Z2dWOn/9koxGc61Ia5FLaRe2bWh8EaRdOX kC9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=z60spNcJ; 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 g71-v6si3198918pfd.86.2018.06.25.07.13.30; Mon, 25 Jun 2018 07:13:46 -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=z60spNcJ; 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 S934253AbeFYOMV (ORCPT + 99 others); Mon, 25 Jun 2018 10:12:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:58288 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934014AbeFYOMU (ORCPT ); Mon, 25 Jun 2018 10:12:20 -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 D5CE325B23; Mon, 25 Jun 2018 14:12:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1529935940; bh=VfNNxvp6ThM1ZItBxPzRPhE/30unO3suc1Kge+4iWuA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=z60spNcJ21ph5q1DhSO6fs/fLCLIoflFQ5lOiNC/wX6i6/MGjI0IRIBRHBzWOf+8h CYLxM+0Q33muWbyfz4vNK4vAHRzl2Ep0ciy8RI39OBQYP8EorQvLi++e/5wPv/fUYW d89/t2zTxQpJJQzhq7fMeg9TCN7efdej3IDb7YUk= Received: by jouet.infradead.org (Postfix, from userid 1000) id 73C471401E5; Mon, 25 Jun 2018 11:12:17 -0300 (-03) Date: Mon, 25 Jun 2018 11:12:17 -0300 From: Arnaldo Carvalho de Melo To: Dmitry Torokhov Cc: Yury Norov , 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 , Andrew Morton , Mike Snitzer Subject: Re: [PATCH 2/2] bitmap: sync tools with new bitmap allocation API Message-ID: <20180625141217.GW20477@kernel.org> References: <20180623073502.16321-1-ynorov@caviumnetworks.com> <20180623073502.16321-2-ynorov@caviumnetworks.com> <20180624213103.GA166241@dtor-ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180624213103.GA166241@dtor-ws> 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 Sun, Jun 24, 2018 at 02:31:03PM -0700, Dmitry Torokhov escreveu: > 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. But neverthless these should be fixed, we can't rule out having some long lived 'perf top' like tool, etc. I.e. when you find missing the delete/free counterpart calls to new/alloc operations, please send fixes. - Arnaldo > 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