lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1368028987-8369-14-git-send-email-mgorman@suse.de>
Date:	Wed,  8 May 2013 17:02:58 +0100
From:	Mel Gorman <mgorman@...e.de>
To:	Linux-MM <linux-mm@...ck.org>
Cc:	Johannes Weiner <hannes@...xchg.org>, Dave Hansen <dave@...1.net>,
	Christoph Lameter <cl@...ux.com>,
	LKML <linux-kernel@...r.kernel.org>, Mel Gorman <mgorman@...e.de>
Subject: [PATCH 13/22] mm: page allocator: Use list_splice to refill the magazine

No need to operate on one page at a time.

Signed-off-by: Mel Gorman <mgorman@...e.de>
---
 mm/page_alloc.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index bb2f116..c014b7a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1333,6 +1333,7 @@ struct page *rmqueue_magazine(struct zone *zone, int migratetype)
 	/* Only acquire the lock if there is a reasonable chance of success */
 	if (zone->noirq_magazine.nr_free) {
 		spin_lock(&zone->magazine_lock);
+retry:
 		page = __rmqueue_magazine(zone, migratetype);
 		spin_unlock(&zone->magazine_lock);
 	}
@@ -1350,7 +1351,7 @@ struct page *rmqueue_magazine(struct zone *zone, int migratetype)
 			page = __rmqueue(zone, 0, migratetype);
 			if (!page)
 				break;
-			list_add_tail(&page->lru, &alloc_list);
+			list_add(&page->lru, &alloc_list);
 			nr_alloced++;
 		}
 		if (!is_migrate_cma(mt))
@@ -1358,15 +1359,13 @@ struct page *rmqueue_magazine(struct zone *zone, int migratetype)
 		else
 			__mod_zone_page_state(zone, NR_FREE_CMA_PAGES, -nr_alloced);
 		spin_unlock_irqrestore(&zone->lock, flags);
+		if (!nr_alloced)
+			return NULL;
 
 		spin_lock(&zone->magazine_lock);
-		while (!list_empty(&alloc_list)) {
-			page = list_entry(alloc_list.next, struct page, lru);
-			list_move_tail(&page->lru, &area->free_list[migratetype]);
-			area->nr_free++;
-		}
-		page = __rmqueue_magazine(zone, migratetype);
-		spin_unlock(&zone->magazine_lock);
+		list_splice(&alloc_list, &area->free_list[migratetype]);
+		area->nr_free += nr_alloced;
+		goto retry;
 	}
 
 	return page;
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ