linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mel Gorman <mel@csn.ul.ie>
To: clameter@sgi.com
Cc: Mel Gorman <mel@csn.ul.ie>, linux-mm@kvack.org
Subject: [PATCH 3/4] Use SLAB_ACCOUNT_RECLAIM to determine when __GFP_RECLAIMABLE should be used
Date: Mon, 30 Apr 2007 19:56:24 +0100 (IST)	[thread overview]
Message-ID: <20070430185624.7142.5198.sendpatchset@skynet.skynet.ie> (raw)
In-Reply-To: <20070430185524.7142.56162.sendpatchset@skynet.skynet.ie>

A number of slab caches are reclaimable and some of their allocation
callsites were updated to use the __GFP_RECLAIMABLE flag. However, slabs
that are reclaimable specify the SLAB_ACCOUNT_RECLAIM flag at creation time
and this information is available at the time of page allocation.

This patch uses the SLAB_ACCOUNT_RECLAIM flag in the SLAB and SLUB
allocators to determine if __GFP_RECLAIMABLE should be used when allocating
pages. The SLOB allocator is not updated as it is unlikely to be used on
a system where grouping pages by mobility is worthwhile. The callsites
for reclaimable cache allocations  no longer specify __GFP_RECLAIMABLE
as the information is redundant. This can be considered as fix to
group-short-lived-and-reclaimable-kernel-allocations.patch.

Credit goes to Christoph Lameter for identifying this problem during review
and suggesting this fix.

Signed-off-by: Mel Gorman <mel@csn.ul.ie>
Acked-by: Andy Whitcroft <apw@shadowen.org>
---

 fs/dcache.c         |    2 +-
 fs/ext2/super.c     |    3 +--
 fs/ext3/super.c     |    2 +-
 fs/ntfs/inode.c     |    4 ++--
 fs/reiserfs/super.c |    3 +--
 mm/slab.c           |    2 ++
 mm/slub.c           |    3 +++
 7 files changed, 11 insertions(+), 8 deletions(-)

diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.21-rc7-mm2-001_deprecate/fs/dcache.c linux-2.6.21-rc7-mm2-002_account_reclaimable/fs/dcache.c
--- linux-2.6.21-rc7-mm2-001_deprecate/fs/dcache.c	2007-04-27 22:04:33.000000000 +0100
+++ linux-2.6.21-rc7-mm2-002_account_reclaimable/fs/dcache.c	2007-04-30 16:08:39.000000000 +0100
@@ -904,7 +904,7 @@ struct dentry *d_alloc(struct dentry * p
 	struct dentry *dentry;
 	char *dname;
 
-	dentry = kmem_cache_alloc(dentry_cache, GFP_KERNEL|__GFP_RECLAIMABLE);
+	dentry = kmem_cache_alloc(dentry_cache, GFP_KERNEL);
 	if (!dentry)
 		return NULL;
 
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.21-rc7-mm2-001_deprecate/fs/ext2/super.c linux-2.6.21-rc7-mm2-002_account_reclaimable/fs/ext2/super.c
--- linux-2.6.21-rc7-mm2-001_deprecate/fs/ext2/super.c	2007-04-27 22:04:33.000000000 +0100
+++ linux-2.6.21-rc7-mm2-002_account_reclaimable/fs/ext2/super.c	2007-04-30 16:22:29.000000000 +0100
@@ -140,8 +140,7 @@ static struct kmem_cache * ext2_inode_ca
 static struct inode *ext2_alloc_inode(struct super_block *sb)
 {
 	struct ext2_inode_info *ei;
-	ei = (struct ext2_inode_info *)kmem_cache_alloc(ext2_inode_cachep,
-						GFP_KERNEL|__GFP_RECLAIMABLE);
+	ei = (struct ext2_inode_info *)kmem_cache_alloc(ext2_inode_cachep, GFP_KERNEL);
 	if (!ei)
 		return NULL;
 #ifdef CONFIG_EXT2_FS_POSIX_ACL
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.21-rc7-mm2-001_deprecate/fs/ext3/super.c linux-2.6.21-rc7-mm2-002_account_reclaimable/fs/ext3/super.c
--- linux-2.6.21-rc7-mm2-001_deprecate/fs/ext3/super.c	2007-04-27 22:04:33.000000000 +0100
+++ linux-2.6.21-rc7-mm2-002_account_reclaimable/fs/ext3/super.c	2007-04-30 16:08:39.000000000 +0100
@@ -445,7 +445,7 @@ static struct inode *ext3_alloc_inode(st
 {
 	struct ext3_inode_info *ei;
 
-	ei = kmem_cache_alloc(ext3_inode_cachep, GFP_NOFS|__GFP_RECLAIMABLE);
+	ei = kmem_cache_alloc(ext3_inode_cachep, GFP_NOFS);
 	if (!ei)
 		return NULL;
 #ifdef CONFIG_EXT3_FS_POSIX_ACL
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.21-rc7-mm2-001_deprecate/fs/ntfs/inode.c linux-2.6.21-rc7-mm2-002_account_reclaimable/fs/ntfs/inode.c
--- linux-2.6.21-rc7-mm2-001_deprecate/fs/ntfs/inode.c	2007-04-27 22:04:33.000000000 +0100
+++ linux-2.6.21-rc7-mm2-002_account_reclaimable/fs/ntfs/inode.c	2007-04-30 16:08:39.000000000 +0100
@@ -323,7 +323,7 @@ struct inode *ntfs_alloc_big_inode(struc
 	ntfs_inode *ni;
 
 	ntfs_debug("Entering.");
-	ni = kmem_cache_alloc(ntfs_big_inode_cache, GFP_NOFS|__GFP_RECLAIMABLE);
+	ni = kmem_cache_alloc(ntfs_big_inode_cache, GFP_NOFS);
 	if (likely(ni != NULL)) {
 		ni->state = 0;
 		return VFS_I(ni);
@@ -348,7 +348,7 @@ static inline ntfs_inode *ntfs_alloc_ext
 	ntfs_inode *ni;
 
 	ntfs_debug("Entering.");
-	ni = kmem_cache_alloc(ntfs_inode_cache, GFP_NOFS|__GFP_RECLAIMABLE);
+	ni = kmem_cache_alloc(ntfs_inode_cache, GFP_NOFS);
 	if (likely(ni != NULL)) {
 		ni->state = 0;
 		return ni;
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.21-rc7-mm2-001_deprecate/fs/reiserfs/super.c linux-2.6.21-rc7-mm2-002_account_reclaimable/fs/reiserfs/super.c
--- linux-2.6.21-rc7-mm2-001_deprecate/fs/reiserfs/super.c	2007-04-27 22:04:33.000000000 +0100
+++ linux-2.6.21-rc7-mm2-002_account_reclaimable/fs/reiserfs/super.c	2007-04-30 16:08:39.000000000 +0100
@@ -496,8 +496,7 @@ static struct inode *reiserfs_alloc_inod
 {
 	struct reiserfs_inode_info *ei;
 	ei = (struct reiserfs_inode_info *)
-	    kmem_cache_alloc(reiserfs_inode_cachep,
-						GFP_KERNEL|__GFP_RECLAIMABLE);
+	    kmem_cache_alloc(reiserfs_inode_cachep, GFP_KERNEL);
 	if (!ei)
 		return NULL;
 	return &ei->vfs_inode;
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.21-rc7-mm2-001_deprecate/mm/slab.c linux-2.6.21-rc7-mm2-002_account_reclaimable/mm/slab.c
--- linux-2.6.21-rc7-mm2-001_deprecate/mm/slab.c	2007-04-27 22:04:34.000000000 +0100
+++ linux-2.6.21-rc7-mm2-002_account_reclaimable/mm/slab.c	2007-04-30 16:17:34.000000000 +0100
@@ -1656,6 +1656,8 @@ static void *kmem_getpages(struct kmem_c
 #endif
 
 	flags |= cachep->gfpflags;
+	if (cachep->flags & SLAB_RECLAIM_ACCOUNT)
+		flags |= __GFP_RECLAIMABLE;
 
 	page = alloc_pages_node(nodeid, flags, cachep->gfporder);
 	if (!page)
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.21-rc7-mm2-001_deprecate/mm/slub.c linux-2.6.21-rc7-mm2-002_account_reclaimable/mm/slub.c
--- linux-2.6.21-rc7-mm2-001_deprecate/mm/slub.c	2007-04-27 22:04:34.000000000 +0100
+++ linux-2.6.21-rc7-mm2-002_account_reclaimable/mm/slub.c	2007-04-30 16:17:44.000000000 +0100
@@ -762,6 +762,9 @@ static struct page *allocate_slab(struct
 	if (s->flags & SLAB_CACHE_DMA)
 		flags |= SLUB_DMA;
 
+	if (s->flags & SLAB_ACCOUNT_RECLAIM)
+		gfpflags |= __GFP_RECLAIMABLE;
+
 	if (node == -1)
 		page = alloc_pages(flags, s->order);
 	else

--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2007-04-30 18:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-30 18:55 [PATCH 0/4] Clarify GFP flag usage when grouping pages by mobility Mel Gorman
2007-04-30 18:55 ` [PATCH 1/4] Fix alloc_zeroed_user_highpage on m68knommu Mel Gorman
2007-04-30 18:56 ` [PATCH 2/4] Remove alloc_zeroed_user_highpage() Mel Gorman
2007-04-30 18:56 ` Mel Gorman [this message]
2007-04-30 19:02   ` [PATCH 3/4] Use SLAB_ACCOUNT_RECLAIM to determine when __GFP_RECLAIMABLE should be used Christoph Lameter
2007-04-30 18:56 ` [PATCH 4/4] Add __GFP_TEMPORARY to identify allocations that are short-lived Mel Gorman
2007-04-30 19:08   ` Christoph Lameter
2007-04-30 19:44     ` Mel Gorman
2007-04-30 19:52       ` Christoph Lameter
2007-04-30 20:11         ` Mel Gorman
2007-04-30 20:14           ` Christoph Lameter
2007-04-30 20:33             ` Mel Gorman

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=20070430185624.7142.5198.sendpatchset@skynet.skynet.ie \
    --to=mel@csn.ul.ie \
    --cc=clameter@sgi.com \
    --cc=linux-mm@kvack.org \
    /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