From: KUROSAWA Takahiro <kurosawa@valinux.co.jp>
To: sekharan@us.ibm.com
Cc: ckrm-tech@lists.sourceforge.net, linux-mm@kvack.org
Subject: Re: [ckrm-tech] [PATCH 0/8] Pzone based CKRM memory resource controller
Date: Fri, 3 Feb 2006 18:37:34 +0900 [thread overview]
Message-ID: <20060203093735.16FE77402D@sv1.valinux.co.jp> (raw)
In-Reply-To: <20060203013358.6EA1F7403C@sv1.valinux.co.jp>
[-- Attachment #1: Type: text/plain, Size: 1201 bytes --]
On Fri, 3 Feb 2006 10:33:58 +0900
KUROSAWA Takahiro <kurosawa@valinux.co.jp> wrote:
> On Tue, 31 Jan 2006 19:07:35 -0800
> chandra seetharaman <sekharan@us.ibm.com> wrote:
>
> > I tried to use the controller but having some problems.
> >
> > - Created class a,
> > - set guarantee to 50(with parent having 100, i expected class a to get
> > 50% of memory in the system).
> > - moved my shell to class a.
> > - Issued a make in the kernel tree.
> > It consistently fails with
> > -----------
> > make: getcwd: : Cannot allocate memory
> > Makefile:313: /scripts/Kbuild.include: No such file or directory
> > Makefile:532: /arch/i386/Makefile: No such file or directory
> > Can't open perl script "/scripts/setlocalversion": No such file or
> > directory
> > make: *** No rule to make target `/arch/i386/Makefile'. Stop.
> > -----------
> > Note that the compilation succeeds if I move my shell to the default
> > class.
>
> I could reproduce this problem. Could you try the attached patch?
I'm sorry, the patch attached to my previous mail has a severe bug.
Could you try this patch instead?
Also, the code still doesn't work if you enable preemption because of
a locking problem so far...
[-- Attachment #2: memrc-pzone-gfp-fix2.diff --]
[-- Type: text/plain, Size: 3817 bytes --]
Index: mm/mem_rc_pzone.c
===================================================================
RCS file: /cvsroot/ckrm/memrc-pzone/mm/mem_rc_pzone.c,v
retrieving revision 1.9
diff -u -p -r1.9 mem_rc_pzone.c
--- mm/mem_rc_pzone.c 19 Jan 2006 05:40:13 -0000 1.9
+++ mm/mem_rc_pzone.c 3 Feb 2006 08:30:15 -0000
@@ -38,7 +38,7 @@ struct mem_rc {
unsigned long guarantee;
struct mem_rc_domain *rcd;
struct zone **zones[MAX_NUMNODES];
- struct zonelist *zonelists[MAX_NUMNODES];
+ struct zonelist *zonelists[MAX_NUMNODES][GFP_ZONETYPES];
};
@@ -109,7 +109,7 @@ static void *mem_rc_create(void *arg, st
struct zone *parent, *z, *z_ref;
pg_data_t *pgdat;
int node, allocn;
- int i, j;
+ int i, j, k;
allocn = first_node(rcd->nodes);
mr = kmalloc_node(sizeof(*mr), GFP_KERNEL, allocn);
@@ -132,13 +132,16 @@ static void *mem_rc_create(void *arg, st
memset(mr->zones[node], 0,
sizeof(*mr->zones[node]) * MAX_NR_ZONES);
- mr->zonelists[node]
- = kmalloc_node(sizeof(*mr->zonelists[node]),
- GFP_KERNEL, allocn);
- if (!mr->zonelists[node])
- goto failed;
+ for (i = 0; i < GFP_ZONETYPES; i++) {
+ mr->zonelists[node][i]
+ = kmalloc_node(sizeof(*mr->zonelists[node][i]),
+ GFP_KERNEL, allocn);
+ if (!mr->zonelists[node][i])
+ goto failed;
- memset(mr->zonelists[node], 0, sizeof(*mr->zonelists[node]));
+ memset(mr->zonelists[node][i], 0,
+ sizeof(*mr->zonelists[node][i]));
+ }
for (i = 0; i < MAX_NR_ZONES; i++) {
parent = pgdat->node_zones + i;
@@ -153,21 +156,22 @@ static void *mem_rc_create(void *arg, st
}
for_each_node_mask(node, rcd->nodes) {
- /* NORMAL zones and DMA zones also in HIGHMEM zonelist. */
- zl_ref = NODE_DATA(node)->node_zonelists + __GFP_HIGHMEM;
- zl = mr->zonelists[node];
-
- for (j = i = 0; i < ARRAY_SIZE(zl_ref->zones); i++) {
- z_ref = zl_ref->zones[i];
- if (!z_ref)
- break;
-
- z = mr->zones[node][zone_idx(z_ref)];
- if (!z)
- continue;
- zl->zones[j++] = z;
+ for (i = 0; i < GFP_ZONETYPES; i++) {
+ zl_ref = NODE_DATA(node)->node_zonelists + i;
+ zl = mr->zonelists[node][i];
+
+ for (j = k = 0; k < ARRAY_SIZE(zl_ref->zones); k++) {
+ z_ref = zl_ref->zones[k];
+ if (!z_ref)
+ break;
+
+ z = mr->zones[z_ref->zone_pgdat->node_id][zone_idx(z_ref)];
+ if (!z)
+ continue;
+ zl->zones[j++] = z;
+ }
+ zl->zones[j] = NULL;
}
- zl->zones[j] = NULL;
}
up(&rcd->sem);
@@ -175,8 +179,10 @@ static void *mem_rc_create(void *arg, st
failed:
for_each_node_mask(node, rcd->nodes) {
- if (mr->zonelists[node])
- kfree(mr->zonelists[node]);
+ for (i = 0; i < GFP_ZONETYPES; i++) {
+ if (mr->zonelists[node][i])
+ kfree(mr->zonelists[node][i]);
+ }
if (!mr->zones[node])
continue;
@@ -204,8 +210,10 @@ static void mem_rc_destroy(void *p)
down(&rcd->sem);
for (node = 0; node < MAX_NUMNODES; node++) {
- if (mr->zonelists[node])
- kfree(mr->zonelists[node]);
+ for (i = 0; i < GFP_ZONETYPES; i++) {
+ if (mr->zonelists[node][i])
+ kfree(mr->zonelists[node][i]);
+ }
if (!mr->zones[node])
continue;
@@ -341,14 +349,15 @@ EXPORT_SYMBOL(mem_rc_get);
struct page *alloc_page_mem_rc(int nid, gfp_t gfpmask)
{
struct mem_rc *mr;
+ gfp_t zoneidx = gfpmask & GFP_ZONEMASK;
mr = mem_rc_get(current);
if (!mr)
return __alloc_pages(gfpmask, 0,
NODE_DATA(nid)->node_zonelists
- + (gfpmask & GFP_ZONEMASK));
+ + zoneidx);
- return __alloc_pages(gfpmask, 0, mr->zonelists[nid]);
+ return __alloc_pages(gfpmask, 0, mr->zonelists[nid][zoneidx]);
}
EXPORT_SYMBOL(alloc_page_mem_rc);
@@ -364,5 +373,5 @@ struct zonelist *mem_rc_get_zonelist(int
if (!mr)
return NULL;
- return mr->zonelists[nd];
+ return mr->zonelists[nd][gfpmask & GFP_ZONEMASK];
}
prev parent reply other threads:[~2006-02-03 9:37 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-19 8:04 [PATCH 0/2] " KUROSAWA Takahiro
2006-01-19 8:04 ` [PATCH 1/2] Add the pzone KUROSAWA Takahiro
2006-01-19 18:04 ` Andy Whitcroft
2006-01-19 23:42 ` KUROSAWA Takahiro
2006-01-20 9:17 ` Andy Whitcroft
2006-01-20 7:08 ` KAMEZAWA Hiroyuki
2006-01-20 8:22 ` KUROSAWA Takahiro
2006-01-20 8:30 ` KAMEZAWA Hiroyuki
2006-01-19 8:04 ` [PATCH 2/2] Add CKRM memory resource controller using pzones KUROSAWA Takahiro
2006-01-31 2:30 ` [PATCH 0/8] Pzone based CKRM memory resource controller KUROSAWA Takahiro
2006-01-31 2:30 ` [PATCH 1/8] Add the __GFP_NOLRU flag KUROSAWA Takahiro
2006-01-31 18:18 ` [ckrm-tech] " Dave Hansen
2006-02-01 5:06 ` KUROSAWA Takahiro
2006-01-31 2:30 ` [PATCH 2/8] Keep the number of zones while zone iterator loop KUROSAWA Takahiro
2006-01-31 2:30 ` [PATCH 3/8] Add for_each_zone_in_node macro KUROSAWA Takahiro
2006-01-31 2:30 ` [PATCH 4/8] Extract zone specific routines as functions KUROSAWA Takahiro
2006-01-31 2:30 ` [PATCH 5/8] Add the pzone_create() function KUROSAWA Takahiro
2006-01-31 2:30 ` [PATCH 6/8] Add the pzone_destroy() function KUROSAWA Takahiro
2006-01-31 2:30 ` [PATCH 7/8] Make the number of pages in pzones resizable KUROSAWA Takahiro
2006-01-31 2:30 ` [PATCH 8/8] Add a CKRM memory resource controller using pzones KUROSAWA Takahiro
2006-02-01 2:58 ` [ckrm-tech] [PATCH 0/8] Pzone based CKRM memory resource controller chandra seetharaman
2006-02-01 5:39 ` KUROSAWA Takahiro
2006-02-01 6:16 ` Hirokazu Takahashi
2006-02-02 1:26 ` chandra seetharaman
2006-02-02 3:54 ` KUROSAWA Takahiro
2006-02-03 0:37 ` chandra seetharaman
2006-02-03 0:51 ` KUROSAWA Takahiro
2006-02-03 1:01 ` chandra seetharaman
2006-02-01 3:07 ` chandra seetharaman
2006-02-01 5:54 ` KUROSAWA Takahiro
2006-02-03 1:33 ` KUROSAWA Takahiro
2006-02-03 9:37 ` KUROSAWA Takahiro [this message]
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=20060203093735.16FE77402D@sv1.valinux.co.jp \
--to=kurosawa@valinux.co.jp \
--cc=ckrm-tech@lists.sourceforge.net \
--cc=linux-mm@kvack.org \
--cc=sekharan@us.ibm.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