From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx160.postini.com [74.125.245.160]) by kanga.kvack.org (Postfix) with SMTP id 70F9E6B0294 for ; Thu, 2 May 2013 20:01:49 -0400 (EDT) Received: from /spool/local by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 2 May 2013 18:01:48 -0600 Received: from d03relay05.boulder.ibm.com (d03relay05.boulder.ibm.com [9.17.195.107]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 878F33E40040 for ; Thu, 2 May 2013 18:01:03 -0600 (MDT) Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d03relay05.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r4301BIj064464 for ; Thu, 2 May 2013 18:01:13 -0600 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r4301BXi029473 for ; Thu, 2 May 2013 18:01:11 -0600 From: Cody P Schafer Subject: [RFC PATCH v3 03/31] mm/memory_hotplug: factor out zone+pgdat growth. Date: Thu, 2 May 2013 17:00:35 -0700 Message-Id: <1367539263-19999-4-git-send-email-cody@linux.vnet.ibm.com> In-Reply-To: <1367539263-19999-1-git-send-email-cody@linux.vnet.ibm.com> References: <1367539263-19999-1-git-send-email-cody@linux.vnet.ibm.com> Sender: owner-linux-mm@kvack.org List-ID: To: Linux MM Cc: LKML , Cody P Schafer , Simon Jeons Create a new function grow_pgdat_and_zone() which handles locking + growth of a zone & the pgdat which it is associated with. Signed-off-by: Cody P Schafer --- include/linux/memory_hotplug.h | 3 +++ mm/memory_hotplug.c | 17 +++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index 3e622c6..501e9f0 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -78,6 +78,9 @@ static inline void zone_seqlock_init(struct zone *zone) { seqlock_init(&zone->span_seqlock); } +extern void grow_pgdat_and_zone(struct zone *zone, unsigned long start_pfn, + unsigned long end_pfn); + extern int zone_grow_free_lists(struct zone *zone, unsigned long new_nr_pages); extern int zone_grow_waitqueues(struct zone *zone, unsigned long nr_pages); extern int add_one_highpage(struct page *page, int pfn, int bad_ppro); diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index a221fac..fafeaae 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -390,13 +390,22 @@ static void grow_pgdat_span(struct pglist_data *pgdat, unsigned long start_pfn, pgdat->node_start_pfn; } +void grow_pgdat_and_zone(struct zone *zone, unsigned long start_pfn, + unsigned long end_pfn) +{ + unsigned long flags; + pgdat_resize_lock(zone->zone_pgdat, &flags); + grow_zone_span(zone, start_pfn, end_pfn); + grow_pgdat_span(zone->zone_pgdat, start_pfn, end_pfn); + pgdat_resize_unlock(zone->zone_pgdat, &flags); +} + static int __meminit __add_zone(struct zone *zone, unsigned long phys_start_pfn) { struct pglist_data *pgdat = zone->zone_pgdat; int nr_pages = PAGES_PER_SECTION; int nid = pgdat->node_id; int zone_type; - unsigned long flags; int ret; zone_type = zone - pgdat->node_zones; @@ -404,11 +413,7 @@ static int __meminit __add_zone(struct zone *zone, unsigned long phys_start_pfn) if (ret) return ret; - pgdat_resize_lock(zone->zone_pgdat, &flags); - grow_zone_span(zone, phys_start_pfn, phys_start_pfn + nr_pages); - grow_pgdat_span(zone->zone_pgdat, phys_start_pfn, - phys_start_pfn + nr_pages); - pgdat_resize_unlock(zone->zone_pgdat, &flags); + grow_pgdat_and_zone(zone, phys_start_pfn, phys_start_pfn + nr_pages); memmap_init_zone(nr_pages, nid, zone_type, phys_start_pfn, MEMMAP_HOTPLUG); return 0; -- 1.8.2.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org