From: Matthew Wilcox <willy@infradead.org> To: Dan Williams <dan.j.williams@intel.com> Cc: linux-kernel@vger.kernel.org, Keith Busch <keith.busch@intel.com>, vishal.l.verma@intel.com, x86@kernel.org, linux-mm@kvack.org, linux-nvdimm@lists.01.org Subject: Re: [RFC PATCH 2/5] lib/memregion: Uplevel the pmem "region" ida to a global allocator Date: Thu, 4 Apr 2019 12:32:11 -0700 Message-ID: <20190404193211.GK22763@bombadil.infradead.org> (raw) In-Reply-To: <155440491849.3190322.17551464505265122881.stgit@dwillia2-desk3.amr.corp.intel.com> On Thu, Apr 04, 2019 at 12:08:38PM -0700, Dan Williams wrote: > +++ b/lib/Kconfig > @@ -318,6 +318,12 @@ config DECOMPRESS_LZ4 > config GENERIC_ALLOCATOR > bool > > +# > +# Generic IDA for memory regions > +# Leaky abstraction -- nobody needs know that it's implemented as an IDA. Suggest: # Memory region ID allocation ... > +++ b/lib/memregion.c > @@ -0,0 +1,22 @@ > +#include <linux/idr.h> > +#include <linux/module.h> > + > +static DEFINE_IDA(region_ida); > + > +int memregion_alloc(void) > +{ > + return ida_simple_get(®ion_ida, 0, 0, GFP_KERNEL); > +} > +EXPORT_SYMBOL(memregion_alloc); > + > +void memregion_free(int id) > +{ > + ida_simple_remove(®ion_ida, id); > +} > +EXPORT_SYMBOL(memregion_free); > + > +static void __exit memregion_exit(void) > +{ > + ida_destroy(®ion_ida); > +} > +module_exit(memregion_exit); - Should these be EXPORT_SYMBOL_GPL? - Can we use the new interface, ida_alloc() and ida_free()? - Do we really want memregion_exit() to happen while there are still IDs allocated in the IDA? I think this might well be better as: BUG_ON(!ida_empty(®ion_ida)); Also, do we really want to call the structure the region_ida? Why not region_ids?
next prev parent reply index Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-04-04 19:08 [RFC PATCH 0/5] EFI Special Purpose Memory Support Dan Williams 2019-04-04 19:08 ` [RFC PATCH 1/5] efi: Detect UEFI 2.8 Special Purpose Memory Dan Williams 2019-04-06 4:21 ` Ard Biesheuvel 2019-04-09 16:43 ` Dan Williams 2019-04-09 17:21 ` Ard Biesheuvel 2019-04-10 2:10 ` Dan Williams 2019-04-12 20:43 ` Ard Biesheuvel 2019-04-12 21:18 ` Dan Williams 2019-04-15 11:43 ` Enrico Weigelt, metux IT consult 2019-04-04 19:08 ` [RFC PATCH 2/5] lib/memregion: Uplevel the pmem "region" ida to a global allocator Dan Williams 2019-04-04 19:32 ` Matthew Wilcox [this message] 2019-04-04 21:02 ` Dan Williams 2019-04-04 19:08 ` [RFC PATCH 3/5] acpi/hmat: Track target address ranges Dan Williams 2019-04-04 20:58 ` Keith Busch 2019-04-04 20:58 ` Dan Williams 2019-04-04 19:08 ` [RFC PATCH 4/5] acpi/hmat: Register special purpose memory as a device Dan Williams 2019-04-05 11:18 ` Jonathan Cameron 2019-04-05 15:43 ` Dan Williams 2019-04-05 16:23 ` Jonathan Cameron 2019-04-05 16:56 ` Dan Williams 2019-04-05 17:39 ` Jonathan Cameron 2019-04-09 12:13 ` Christoph Hellwig 2019-04-09 14:49 ` Dan Williams 2019-04-04 19:08 ` [RFC PATCH 5/5] device-dax: Add a driver for "hmem" devices Dan Williams
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190404193211.GK22763@bombadil.infradead.org \ --to=willy@infradead.org \ --cc=dan.j.williams@intel.com \ --cc=keith.busch@intel.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=linux-nvdimm@lists.01.org \ --cc=vishal.l.verma@intel.com \ --cc=x86@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
LKML Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \ linux-kernel@vger.kernel.org public-inbox-index lkml Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git