From: Joel Schopp <jschopp@austin.ibm.com>
To: Paul Jackson <pj@sgi.com>
Cc: Dave Hansen <haveblue@us.ibm.com>,
linux-mm@kvack.org, Mel Gorman <mel@csn.ul.ie>
Subject: Re: [Fwd: [PATCH 2/4] cpusets new __GFP_HARDWALL flag]
Date: Mon, 11 Jul 2005 12:36:15 -0500 [thread overview]
Message-ID: <42D2AE0F.8020809@austin.ibm.com> (raw)
In-Reply-To: <1121101013.15095.19.camel@localhost>
[-- Attachment #1: Type: text/plain, Size: 2946 bytes --]
Dave Hansen brought this to my attention. I've attached the bit of the
memory fragmentation avoidance you conflict with (I'm working with Mel
on his patches). I think we share similar goals, and I wouldn't mind
changing __GFP_USERRCLM to __GFP_USERALLOC or some neutral name we could
share. Anything to increase the chances of fragmentation avoidance
getting merged is good in my book.
-Joel
>>GFP_USER allocations, and distinguish them from GFP_KERNEL allocations.
>>
>>Allocations (such as GFP_USER) marked GFP_HARDWALL are constrainted to
>>the current tasks cpuset. Other allocations (such as GFP_KERNEL) can
>>steal from the possibly larger nearest mem_exclusive cpuset ancestor,
>>if memory is tight on every node in the current cpuset.
>>
>>This patch collides with Mel Gorman's patch to reduce fragmentation
>>in the standard buddy allocator, which adds two GFP flags. At first
>>glance, it seems that his added __GFP_USERRCLM flag could be used in
>>place of the following __GFP_HARDWALL, as they both seem to be set
>>the same way - for GFP_USER and GFP_HIGHUSER. Perhaps we should call
>>this flag __GFP_USER, rather than some name dependent on its use(s).
>
>
> Does this make sense to integrate into your patches?
>
> Index: linux-2.6-mem_exclusive/include/linux/gfp.h
> ===================================================================
> --- linux-2.6-mem_exclusive.orig/include/linux/gfp.h 2005-07-02 17:42:02.000000000 -0700
> +++ linux-2.6-mem_exclusive/include/linux/gfp.h 2005-07-02 17:43:00.000000000 -0700
> @@ -40,6 +40,7 @@ struct vm_area_struct;
> #define __GFP_ZERO 0x8000u /* Return zeroed page on success */
> #define __GFP_NOMEMALLOC 0x10000u /* Don't use emergency reserves */
> #define __GFP_NORECLAIM 0x20000u /* No zone reclaim during page_cache_alloc */
> +#define __GFP_HARDWALL 0x40000u /* Enforce hardwall cpuset memory allocs */
>
> #define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */
> #define __GFP_BITS_MASK ((1 << __GFP_BITS_SHIFT) - 1)
> @@ -48,14 +49,15 @@ struct vm_area_struct;
> #define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \
> __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \
> __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \
> - __GFP_NOMEMALLOC|__GFP_NORECLAIM)
> + __GFP_NOMEMALLOC|__GFP_NORECLAIM|__GFP_HARDWALL)
>
> #define GFP_ATOMIC (__GFP_HIGH)
> #define GFP_NOIO (__GFP_WAIT)
> #define GFP_NOFS (__GFP_WAIT | __GFP_IO)
> #define GFP_KERNEL (__GFP_WAIT | __GFP_IO | __GFP_FS)
> -#define GFP_USER (__GFP_WAIT | __GFP_IO | __GFP_FS)
> -#define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HIGHMEM)
> +#define GFP_USER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL)
> +#define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL | \
> + __GFP_HIGHMEM)
>
> /* Flag - indicates that the buffer will be suitable for DMA. Ignored on some
> platforms, used as appropriate on others */
[-- Attachment #2: patch-defrag-flags --]
[-- Type: text/plain, Size: 5255 bytes --]
Index: 2.6.13-rc1-mhp1/fs/buffer.c
===================================================================
--- 2.6.13-rc1-mhp1.orig/fs/buffer.c 2005-06-29 15:11:40.%N -0500
+++ 2.6.13-rc1-mhp1/fs/buffer.c 2005-07-06 12:30:55.%N -0500
@@ -1110,7 +1110,8 @@ grow_dev_page(struct block_device *bdev,
struct page *page;
struct buffer_head *bh;
- page = find_or_create_page(inode->i_mapping, index, GFP_NOFS);
+ page = find_or_create_page(inode->i_mapping, index,
+ GFP_NOFS | __GFP_USERRCLM);
if (!page)
return NULL;
@@ -3079,7 +3080,8 @@ static void recalc_bh_state(void)
struct buffer_head *alloc_buffer_head(unsigned int __nocast gfp_flags)
{
- struct buffer_head *ret = kmem_cache_alloc(bh_cachep, gfp_flags);
+ struct buffer_head *ret = kmem_cache_alloc(bh_cachep,
+ gfp_flags|__GFP_KERNRCLM);
if (ret) {
preempt_disable();
__get_cpu_var(bh_accounting).nr++;
Index: 2.6.13-rc1-mhp1/fs/dcache.c
===================================================================
--- 2.6.13-rc1-mhp1.orig/fs/dcache.c 2005-06-29 15:11:18.%N -0500
+++ 2.6.13-rc1-mhp1/fs/dcache.c 2005-07-06 12:32:00.%N -0500
@@ -719,7 +719,7 @@ struct dentry *d_alloc(struct dentry * p
struct dentry *dentry;
char *dname;
- dentry = kmem_cache_alloc(dentry_cache, GFP_KERNEL);
+ dentry = kmem_cache_alloc(dentry_cache, GFP_KERNEL|__GFP_KERNRCLM);
if (!dentry)
return NULL;
Index: 2.6.13-rc1-mhp1/fs/ext2/super.c
===================================================================
--- 2.6.13-rc1-mhp1.orig/fs/ext2/super.c 2005-06-29 15:11:18.%N -0500
+++ 2.6.13-rc1-mhp1/fs/ext2/super.c 2005-07-06 12:34:16.%N -0500
@@ -138,7 +138,8 @@ static kmem_cache_t * ext2_inode_cachep;
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, SLAB_KERNEL);
+ ei = (struct ext2_inode_info *)kmem_cache_alloc(ext2_inode_cachep,
+ SLAB_KERNEL|__GFP_KERNRCLM);
if (!ei)
return NULL;
#ifdef CONFIG_EXT2_FS_POSIX_ACL
Index: 2.6.13-rc1-mhp1/fs/ext3/super.c
===================================================================
--- 2.6.13-rc1-mhp1.orig/fs/ext3/super.c 2005-06-29 15:11:18.%N -0500
+++ 2.6.13-rc1-mhp1/fs/ext3/super.c 2005-06-29 16:02:25.%N -0500
@@ -440,7 +440,7 @@ static struct inode *ext3_alloc_inode(st
{
struct ext3_inode_info *ei;
- ei = kmem_cache_alloc(ext3_inode_cachep, SLAB_NOFS);
+ ei = kmem_cache_alloc(ext3_inode_cachep, SLAB_NOFS|__GFP_KERNRCLM);
if (!ei)
return NULL;
#ifdef CONFIG_EXT3_FS_POSIX_ACL
Index: 2.6.13-rc1-mhp1/fs/ntfs/inode.c
===================================================================
--- 2.6.13-rc1-mhp1.orig/fs/ntfs/inode.c 2005-06-29 15:11:18.%N -0500
+++ 2.6.13-rc1-mhp1/fs/ntfs/inode.c 2005-07-06 13:10:49.%N -0500
@@ -317,8 +317,8 @@ struct inode *ntfs_alloc_big_inode(struc
ntfs_inode *ni;
ntfs_debug("Entering.");
- ni = (ntfs_inode *)kmem_cache_alloc(ntfs_big_inode_cache,
- SLAB_NOFS);
+ ni = (ntfs_inode *)kmem_cache_alloc(ntfs_big_inode_cache,
+ SLAB_NOFS|__GFP_KERNRCLM);
if (likely(ni != NULL)) {
ni->state = 0;
return VFS_I(ni);
@@ -343,7 +343,8 @@ static inline ntfs_inode *ntfs_alloc_ext
ntfs_inode *ni;
ntfs_debug("Entering.");
- ni = (ntfs_inode *)kmem_cache_alloc(ntfs_inode_cache, SLAB_NOFS);
+ ni = (ntfs_inode *)kmem_cache_alloc(ntfs_inode_cache,
+ SLAB_NOFS|__GFP_KERNRCLM);
if (likely(ni != NULL)) {
ni->state = 0;
return ni;
Index: 2.6.13-rc1-mhp1/include/linux/gfp.h
===================================================================
--- 2.6.13-rc1-mhp1.orig/include/linux/gfp.h 2005-06-29 15:11:35.%N -0500
+++ 2.6.13-rc1-mhp1/include/linux/gfp.h 2005-07-06 12:39:56.%N -0500
@@ -40,22 +40,26 @@ struct vm_area_struct;
#define __GFP_ZERO 0x8000u /* Return zeroed page on success */
#define __GFP_NOMEMALLOC 0x10000u /* Don't use emergency reserves */
#define __GFP_NORECLAIM 0x20000u /* No realy zone reclaim during allocation */
+#define __GFP_KERNRCLM 0x40000u /* Kernel page that is easily reclaimable */
+#define __GFP_USERRCLM 0x80000u /* User is a userspace user */
-#define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */
+#define __GFP_BITS_SHIFT 22 /* Room for 22 __GFP_FOO bits */
#define __GFP_BITS_MASK ((1 << __GFP_BITS_SHIFT) - 1)
/* if you forget to add the bitmask here kernel will crash, period */
#define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \
__GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \
__GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \
- __GFP_NOMEMALLOC|__GFP_NORECLAIM)
+ __GFP_NOMEMALLOC|__GFP_NORECLAIM| \
+ __GFP_USERRCLM|__GFP_KERNRCLM)
#define GFP_ATOMIC (__GFP_HIGH)
#define GFP_NOIO (__GFP_WAIT)
#define GFP_NOFS (__GFP_WAIT | __GFP_IO)
#define GFP_KERNEL (__GFP_WAIT | __GFP_IO | __GFP_FS)
-#define GFP_USER (__GFP_WAIT | __GFP_IO | __GFP_FS)
-#define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HIGHMEM)
+#define GFP_USER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_USERRCLM)
+#define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HIGHMEM | \
+ __GFP_USERRCLM)
/* Flag - indicates that the buffer will be suitable for DMA. Ignored on some
platforms, used as appropriate on others */
next parent reply other threads:[~2005-07-11 17:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1121101013.15095.19.camel@localhost>
2005-07-11 17:36 ` Joel Schopp [this message]
2005-07-11 17:49 ` Dave Hansen
2005-07-12 2:55 ` Paul Jackson
2005-07-12 5:24 ` Dave Hansen
2005-07-12 6:11 ` Paul Jackson
2005-07-12 13:05 ` Mel Gorman
2005-07-12 20:29 ` Paul Jackson
2005-07-13 11:15 ` Mel Gorman
2005-07-14 11:06 ` Paul Jackson
2005-07-18 12:32 ` Mel Gorman
2005-07-18 20:08 ` Joel Schopp
2005-07-27 8:29 ` Paul Jackson
2005-07-27 11:10 ` 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=42D2AE0F.8020809@austin.ibm.com \
--to=jschopp@austin.ibm.com \
--cc=haveblue@us.ibm.com \
--cc=linux-mm@kvack.org \
--cc=mel@csn.ul.ie \
--cc=pj@sgi.com \
/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