Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752196Ab0AHNF1 (ORCPT ); Fri, 8 Jan 2010 08:05:27 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751912Ab0AHNF1 (ORCPT ); Fri, 8 Jan 2010 08:05:27 -0500 Received: from mga03.intel.com ([143.182.124.21]:13269 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751690Ab0AHNFZ (ORCPT ); Fri, 8 Jan 2010 08:05:25 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.47,316,1257148800"; d="scan'208";a="230630362" Date: Fri, 8 Jan 2010 19:08:10 +0800 From: Wu Fengguang To: "Zheng, Shaohui" Cc: "linux-mm@kvack.org" , "akpm@linux-foundation.org" , "linux-kernel@vger.kernel.org" , "ak@linux.intel.com" , "y-goto@jp.fujitsu.com" , Dave Hansen , "x86@kernel.org" Subject: Re: [PATCH - resend ] memory-hotplug: create /sys/firmware/memmap entry for new memory(v3) Message-ID: <20100108110810.GA6153@localhost> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3875 Lines: 108 On Fri, Jan 08, 2010 at 11:16:13AM +0800, Zheng, Shaohui wrote: > Resend the patch to the mailing-list, the original patch URL is at > http://patchwork.kernel.org/patch/69071/. It is already reviewed, but It is still not > accepted and no comments, I guess that it should be ignored since we have so many > patches each day, send it again. > > memory-hotplug: create /sys/firmware/memmap entry for hot-added memory > > Interface firmware_map_add was not called in explicit, Remove it and add function > firmware_map_add_hotplug as hotplug interface of memmap. > > When we hot-add new memory, sysfs does not export memmap entry for it. we add > a call in function add_memory to function firmware_map_add_hotplug. > > Add a new function add_sysfs_fw_map_entry to create memmap entry, it can avoid > duplicated codes. > > Thanks for the careful review from Fengguang Wu and Dave Hansen. > > Signed-off-by: Shaohui Zheng > Acked-by: Andi Kleen > Acked-by: Yasunori Goto > Acked-by: Dave Hansen > Reviewed-by: Wu Fengguang > --- > diff --git a/drivers/firmware/memmap.c b/drivers/firmware/memmap.c > index 56f9234..ec8c3d4 100644 > --- a/drivers/firmware/memmap.c > +++ b/drivers/firmware/memmap.c > @@ -123,52 +123,75 @@ static int firmware_map_add_entry(u64 start, u64 end, > } > > /** > - * firmware_map_add() - Adds a firmware mapping entry. > + * Add memmap entry on sysfs > + */ > +static int add_sysfs_fw_map_entry(struct firmware_map_entry *entry) { Minor style issue: ERROR: open brace '{' following function declarations go on the next line #31: FILE: drivers/firmware/memmap.c:128: +static int add_sysfs_fw_map_entry(struct firmware_map_entry *entry) { total: 1 errors, 0 warnings, 145 lines checked patches/memory-hotplug-create-sys-firmware-memmap-entry-for-new-memory-v3.patch has style problems, please review. If any of these e rrors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS. > + static int map_entries_nr; > + static struct kset *mmap_kset; > + > + if (!mmap_kset) { > + mmap_kset = kset_create_and_add("memmap", NULL, firmware_kobj); > + if (WARN_ON(!mmap_kset)) This WARN_ON() may never trigger, or when things go terribly wrong it repeatedly produce a dozen stack dumps, which don't really help diagnose the root cause. Better to just remove it. > + return -ENOMEM; > + } > + > + entry->kobj.kset = mmap_kset; > + if (kobject_add(&entry->kobj, NULL, "%d", map_entries_nr++)) > + kobject_put(&entry->kobj); > + > + return 0; > +} > + > +/** > + * firmware_map_add_early() - Adds a firmware mapping entry. > * @start: Start of the memory range. > * @end: End of the memory range (inclusive). > * @type: Type of the memory range. > * > - * This function uses kmalloc() for memory > - * allocation. Use firmware_map_add_early() if you want to use the bootmem > - * allocator. > + * Adds a firmware mapping entry. This function uses the bootmem allocator > + * for memory allocation. > * > * That function must be called before late_initcall. > * > * Returns 0 on success, or -ENOMEM if no memory could be allocated. > **/ > -int firmware_map_add(u64 start, u64 end, const char *type) > +int __init firmware_map_add_early(u64 start, u64 end, const char *type) > { > struct firmware_map_entry *entry; > > - entry = kmalloc(sizeof(struct firmware_map_entry), GFP_ATOMIC); > - if (!entry) > + entry = alloc_bootmem(sizeof(struct firmware_map_entry)); > + if (WARN_ON(!entry)) Ditto. Thanks, Fengguang -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/