<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
From: Manfred Spraul &lt;manfred@colorfullife.com&gt;

slab_reclaim_pages is increased even if get_free_pages fails.  The attached
patch moves the update to the correct position.



 mm/slab.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff -puN mm/slab.c~slab-reclaim-accounting-fix mm/slab.c
--- 25/mm/slab.c~slab-reclaim-accounting-fix	2003-12-14 21:28:31.000000000 -0800
+++ 25-akpm/mm/slab.c	2003-12-14 21:28:31.000000000 -0800
@@ -805,13 +805,13 @@ static inline void *kmem_getpages(kmem_c
 	void *addr;
 
 	flags |= cachep-&gt;gfpflags;
-	if (cachep-&gt;flags &amp; SLAB_RECLAIM_ACCOUNT)
-		atomic_add(1&lt;&lt;cachep-&gt;gfporder, &amp;slab_reclaim_pages);
 	addr = (void*)__get_free_pages(flags, cachep-&gt;gfporder);
 	if (addr) {
 		int i = (1 &lt;&lt; cachep-&gt;gfporder);
 		struct page *page = virt_to_page(addr);
 
+		if (cachep-&gt;flags &amp; SLAB_RECLAIM_ACCOUNT)
+			atomic_add(i, &amp;slab_reclaim_pages);
 		while (i--) {
 			SetPageSlab(page);
 			page++;

_
</pre></body></html>