From: Robin Holt <holt@sgi.com>
To: lkml <linux-kernel@vger.kernel.org>,
Dave Hansen <haveblue@us.ibm.com>,
Matt Tolentino <matthew.e.tolentino@intel.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>,
Badari Pulavarty <pbadari@us.ibm.com>,
Gary Hade <garyhade@us.ibm.com>, Ingo Molnar <mingo@elte.hu>,
"Robert P. J. Day" <rpjday@crashcourse.ca>
Subject: [Patch 2/3] Introduce find_memory_block_hinted which utilizes kset_find_obj_hinted.
Date: Wed, 29 Sep 2010 14:00:55 -0500 [thread overview]
Message-ID: <20100929190115.632695677@gulag1.americas.sgi.com> (raw)
In-Reply-To: <20100929190053.992911934@gulag1.americas.sgi.com>
[-- Attachment #1: add-find_memory_block_hinted --]
[-- Type: text/plain, Size: 3141 bytes --]
Introduce a find_memory_block_hinted() which utilizes the
recently added kset_find_obj_hinted().
Signed-off-by: Robin Holt <holt@sgi.com>
To: Dave Hansen <haveblue@us.ibm.com>
To: Matt Tolentino <matthew.e.tolentino@intel.com>
Cc: lkml <linux-kernel@vger.kernel.org>
---
drivers/base/memory.c | 28 ++++++++++++++++++----------
include/linux/memory.h | 2 ++
2 files changed, 20 insertions(+), 10 deletions(-)
Index: pv1010359/drivers/base/memory.c
===================================================================
--- pv1010359.orig/drivers/base/memory.c 2010-09-29 11:25:41.000000000 -0500
+++ pv1010359/drivers/base/memory.c 2010-09-29 11:33:49.903994093 -0500
@@ -468,28 +468,23 @@ static int add_memory_block(int nid, str
return ret;
}
-/*
- * For now, we have a linear search to go find the appropriate
- * memory_block corresponding to a particular phys_index. If
- * this gets to be a real problem, we can always use a radix
- * tree or something here.
- *
- * This could be made generic for all sysdev classes.
- */
-struct memory_block *find_memory_block(struct mem_section *section)
+struct memory_block *find_memory_block_hinted(struct mem_section *section,
+ struct memory_block *hint)
{
struct kobject *kobj;
struct sys_device *sysdev;
struct memory_block *mem;
char name[sizeof(MEMORY_CLASS_NAME) + 9 + 1];
+ kobj = hint ? &hint->sysdev.kobj : NULL;
+
/*
* This only works because we know that section == sysdev->id
* slightly redundant with sysdev_register()
*/
sprintf(&name[0], "%s%d", MEMORY_CLASS_NAME, __section_nr(section));
- kobj = kset_find_obj(&memory_sysdev_class.kset, name);
+ kobj = kset_find_obj_hinted(&memory_sysdev_class.kset, name, kobj);
if (!kobj)
return NULL;
@@ -499,6 +494,19 @@ struct memory_block *find_memory_block(s
return mem;
}
+/*
+ * For now, we have a linear search to go find the appropriate
+ * memory_block corresponding to a particular phys_index. If
+ * this gets to be a real problem, we can always use a radix
+ * tree or something here.
+ *
+ * This could be made generic for all sysdev classes.
+ */
+struct memory_block *find_memory_block(struct mem_section *section)
+{
+ return find_memory_block_hinted(section, NULL);
+}
+
int remove_memory_block(unsigned long node_id, struct mem_section *section,
int phys_device)
{
Index: pv1010359/include/linux/memory.h
===================================================================
--- pv1010359.orig/include/linux/memory.h 2010-09-29 11:25:41.000000000 -0500
+++ pv1010359/include/linux/memory.h 2010-09-29 11:25:43.289450971 -0500
@@ -113,6 +113,8 @@ extern int memory_dev_init(void);
extern int remove_memory_block(unsigned long, struct mem_section *, int);
extern int memory_notify(unsigned long val, void *v);
extern int memory_isolate_notify(unsigned long val, void *v);
+extern struct memory_block *find_memory_block_hinted(struct mem_section *,
+ struct memory_block *);
extern struct memory_block *find_memory_block(struct mem_section *);
#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT)
enum mem_add_context { BOOT, HOTPLUG };
next prev parent reply other threads:[~2010-09-29 19:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-29 19:00 [Patch 0/3] Speed up link_mem_sections during boot Robin Holt
2010-09-29 19:00 ` [Patch 1/3] Introduce kset_find_obj_hinted Robin Holt
2010-09-29 20:59 ` Dave Hansen
2010-09-29 21:44 ` Robin Holt
2010-09-30 1:59 ` KAMEZAWA Hiroyuki
2010-09-29 19:00 ` Robin Holt [this message]
2010-09-30 2:00 ` [Patch 2/3] Introduce find_memory_block_hinted which utilizes kset_find_obj_hinted KAMEZAWA Hiroyuki
2010-09-29 19:00 ` [Patch 3/3] Convert link_mem_sections to use find_memory_block_hinted Robin Holt
2010-09-30 2:01 ` KAMEZAWA Hiroyuki
2010-10-05 23:18 ` patch "driver core: Convert link_mem_sections to use find_memory_block_hinted." added to gregkh-2.6 tree gregkh
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=20100929190115.632695677@gulag1.americas.sgi.com \
--to=holt@sgi.com \
--cc=garyhade@us.ibm.com \
--cc=gregkh@suse.de \
--cc=haveblue@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew.e.tolentino@intel.com \
--cc=mingo@elte.hu \
--cc=pbadari@us.ibm.com \
--cc=rpjday@crashcourse.ca \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®