Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4487042imm; Mon, 18 Jun 2018 16:11:52 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLt7BI2i5ktykvehOdS4lOnKBVhw4/GQHCPhvJT2JNehRY+UyyXuLNUUzxPRlnDGDrw/7Tz X-Received: by 2002:a65:4b46:: with SMTP id k6-v6mr12812284pgt.113.1529363512347; Mon, 18 Jun 2018 16:11:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529363512; cv=none; d=google.com; s=arc-20160816; b=S6JynhGM05upP2nx4jFO/JZx0RpdzVGvHXkO8Y0KWJ+AQnRYf0pVT8A0Dw25R3lldU Z5efzp3Y0a1ocUJm8wv3ep5wZHaD7tUCAWN63tks5oaC285MDdUpX/N/ryGTYjonAy96 mZ6lCeGb3ZZB+HUoSt0aql0TV5AZqhP50gwylNR19bgHqBCbObTSFqAWa9IqGlzAQw3I WnFVEiCcJr5kN4pXKNDZINpe43hmXnextBpajj6auArYKa0OrNxc80jzKgSi1kFvwUQJ TP9zOIo8EVMmIEm8OwFtF7/EN31VDRMxLD85t/NWt365kwZ80FeMobstKYvULgvXtgi+ jBeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=51pm42dXomsjfnGWWoSOCYZ6mhhXr8HgBFPr1zbfR6A=; b=XPrzN/ZGX9l+5Umg1OJD6D0KNLZ/vvU4Otf29kyx5Zwdv1YnqBjWmGZ09PyTyeLDLf g4bhuGYfxDTEGBqAEd+OCO/tijrefKUmWpVg22ux1+CIqtk+RStgnMdDQKnuQUUonwIe xGEdQIorDaU0RSL1XRzHcFsB06ySW/l13jxtYYoM48tzvTj39ya3Rmt/8OmgDkKd0NU9 3261XIl5UVfwo2PEWYIkb5O/LC4C6HGnQFMa1bjGWPyeEUTzBqCEO/1Oao0HLfxwYFWU 80ADjFvlL1oHIlTXGFAF1nxmxcg9WQ1US+7RVJ9Ub0kWbOnkogNyIxzySYi4XMTJzZpy hSDg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p33-v6si15565811pld.318.2018.06.18.16.11.38; Mon, 18 Jun 2018 16:11:52 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935510AbeFRXLA (ORCPT + 99 others); Mon, 18 Jun 2018 19:11:00 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35984 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755329AbeFRXK6 (ORCPT ); Mon, 18 Jun 2018 19:10:58 -0400 Received: from akpm3.svl.corp.google.com (unknown [104.133.9.92]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id AFB6ED73; Mon, 18 Jun 2018 23:10:57 +0000 (UTC) Date: Mon, 18 Jun 2018 16:10:56 -0700 From: Andrew Morton To: Dmitry Torokhov Cc: Andy Shevchenko , agk@redhat.com, Mike Snitzer , device-mapper development , shli@kernel.org, linux-raid@vger.kernel.org, "linux-input@vger.kernel.org" , ynorov@caviumnetworks.com, lkml , Mika Westerberg , Joe Perches Subject: Re: [PATCH v3 3/5] bitmap: Add bitmap_alloc(), bitmap_zalloc() and bitmap_free() Message-Id: <20180618161056.e52efd0e8bd36211e60705a2@linux-foundation.org> In-Reply-To: References: <20180618131003.88110-1-andriy.shevchenko@linux.intel.com> <20180618131003.88110-4-andriy.shevchenko@linux.intel.com> <20180618141404.68124daab97bd0f3a3051544@linux-foundation.org> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 18 Jun 2018 15:01:43 -0700 Dmitry Torokhov wrote: > > > +unsigned long *bitmap_alloc(unsigned int nbits, gfp_t flags) > > > +{ > > > + return kmalloc_array(BITS_TO_LONGS(nbits), sizeof(unsigned long), flags); > > > +} > > > +EXPORT_SYMBOL(bitmap_alloc); > > > + > > > +unsigned long *bitmap_zalloc(unsigned int nbits, gfp_t flags) > > > +{ > > > + return bitmap_alloc(nbits, flags | __GFP_ZERO); > > > +} > > > +EXPORT_SYMBOL(bitmap_zalloc); > > > + > > > +void bitmap_free(const unsigned long *bitmap) > > > +{ > > > + kfree(bitmap); > > > +} > > > +EXPORT_SYMBOL(bitmap_free); > > > + > > > > I suggest these functions are small and simple enough to justify > > inlining them. > > > > We can't as we end up including bitmap.h (by the way of cpumask.h) > form slab.h, so we gen circular dependency. That info should have been in the changelog, and probably a code comment. > Maybe if we removed memcg > stuff from slab.h so we do not need to include workqueue.h... Or move the basic slab API stuff out of slab.h into a new header. Or create a new, standalone work_struct.h - that looks pretty simple.