* RE: Hugepages demand paging V1 [4/4]: Numa patch
[not found] <B05667366EE6204181EABE9C1B1C0EB504BFA479@scsmsx401.amr.corp.intel.com>
@ 2004-10-27 17:57 ` Christoph Lameter
2004-10-27 20:53 ` Chen, Kenneth W
0 siblings, 1 reply; 11+ messages in thread
From: Christoph Lameter @ 2004-10-27 17:57 UTC (permalink / raw)
To: Chen, Kenneth W; +Cc: William Lee Irwin III, linux-kernel
On Mon, 25 Oct 2004, Chen, Kenneth W wrote:
> > @@ -32,14 +32,17 @@
> > + struct zonelist *zonelist = NODE_DATA(nid)->node_zonelists;
> > + struct zone **zones = zonelist->zones;
> > + struct zone *z;
> > + int i;
> > +
> > + for(i=0; (z = zones[i])!= NULL; i++) {
> > + nid = z->zone_pgdat->node_id;
> > + if (list_empty(&hugepage_freelists[node_id]))
> > + break;
> > }
>
> Also this is generic code, we should consider scanning ZONE_HIGHMEM
> zonelist. Otherwise, this will likely screw up x86 numa machine.
The highmem zones are included in the zones[] array AFAIK.
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: Hugepages demand paging V1 [4/4]: Numa patch
2004-10-27 17:57 ` Hugepages demand paging V1 [4/4]: Numa patch Christoph Lameter
@ 2004-10-27 20:53 ` Chen, Kenneth W
0 siblings, 0 replies; 11+ messages in thread
From: Chen, Kenneth W @ 2004-10-27 20:53 UTC (permalink / raw)
To: 'Christoph Lameter'; +Cc: William Lee Irwin III, linux-kernel
On Mon, 25 Oct 2004, Chen, Kenneth W wrote:
> > @@ -32,14 +32,17 @@
> > + struct zonelist *zonelist = NODE_DATA(nid)->node_zonelists;
> > + struct zone **zones = zonelist->zones;
> > + struct zone *z;
> > + int i;
> > +
> > + for(i=0; (z = zones[i])!= NULL; i++) {
> > + nid = z->zone_pgdat->node_id;
> > + if (list_empty(&hugepage_freelists[node_id]))
> > + break;
> > }
>
> Also this is generic code, we should consider scanning ZONE_HIGHMEM
> zonelist. Otherwise, this will likely screw up x86 numa machine.
Christoph Lameter wrote on Wednesday, October 27, 2004 10:57 AM
> The highmem zones are included in the zones[] array AFAIK.
node_zonelists is an array in the struct pglist_data. In your patch,
you are referencing the first element in that array, which has a zone
list for all node memory in normal zone.
What will happen for a x86 numa box with highmem only on some nodes?
- Ken
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Hugepages demand paging V1 [4/4]: Numa patch
2004-10-25 21:52 ` William Lee Irwin III
@ 2004-10-25 21:55 ` William Lee Irwin III
0 siblings, 0 replies; 11+ messages in thread
From: William Lee Irwin III @ 2004-10-25 21:55 UTC (permalink / raw)
To: Chen, Kenneth W; +Cc: Christoph Lameter, linux-kernel
On Mon, Oct 25, 2004 at 02:25:09PM -0700, Chen, Kenneth W wrote:
>> The allocate from next best node is orthogonal to hugetlb demand paging.
>> This should be merged once all the bugs are fixed and later when demand
>> paging goes in, we can add the mpol_* stuff.
On Mon, Oct 25, 2004 at 02:52:19PM -0700, William Lee Irwin III wrote:
> I'm not too picky about this. It appears to be the 4th of the series,
> so assuming they go in in order that should meet your expectations. I
> am significantly more concerned about the flush_dcache_page() issue in
> general, though. I guess this should light a fire under my backside to
> dredge up the docs describing the proper TLB flushing methods to use
> in conjunction with large page extensions for the affected arches.
Cache flushing methods.
-- wli
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Hugepages demand paging V1 [4/4]: Numa patch
2004-10-25 21:25 ` Chen, Kenneth W
@ 2004-10-25 21:52 ` William Lee Irwin III
2004-10-25 21:55 ` William Lee Irwin III
0 siblings, 1 reply; 11+ messages in thread
From: William Lee Irwin III @ 2004-10-25 21:52 UTC (permalink / raw)
To: Chen, Kenneth W; +Cc: Christoph Lameter, linux-kernel
On Fri, Oct 22, 2004 at 12:37:13PM -0700, Christoph Lameter wrote:
>> How about this variation following __alloc_page:
William Lee Irwin III wrote on Friday, October 22, 2004 12:41 PM
>> Looks reasonable. The bit that struck me as quirky was the mpol_* on
>> the NULL vma. This pretty much eliminates the hidden dispatch, so I'm
>> happy.
On Mon, Oct 25, 2004 at 02:25:09PM -0700, Chen, Kenneth W wrote:
> The allocate from next best node is orthogonal to hugetlb demand paging.
> This should be merged once all the bugs are fixed and later when demand
> paging goes in, we can add the mpol_* stuff.
I'm not too picky about this. It appears to be the 4th of the series,
so assuming they go in in order that should meet your expectations. I
am significantly more concerned about the flush_dcache_page() issue in
general, though. I guess this should light a fire under my backside to
dredge up the docs describing the proper TLB flushing methods to use
in conjunction with large page extensions for the affected arches.
-- wli
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: Hugepages demand paging V1 [4/4]: Numa patch
2004-10-22 19:40 ` William Lee Irwin III
@ 2004-10-25 21:25 ` Chen, Kenneth W
2004-10-25 21:52 ` William Lee Irwin III
0 siblings, 1 reply; 11+ messages in thread
From: Chen, Kenneth W @ 2004-10-25 21:25 UTC (permalink / raw)
To: 'William Lee Irwin III', Christoph Lameter; +Cc: linux-kernel
On Fri, 22 Oct 2004, William Lee Irwin III wrote:
>> dequeue_huge_page() seems to want a nodemask, not a vma, though I
>> suppose it's not particularly pressing.
On Fri, Oct 22, 2004 at 12:37:13PM -0700, Christoph Lameter wrote:
> How about this variation following __alloc_page:
William Lee Irwin III wrote on Friday, October 22, 2004 12:41 PM
> Looks reasonable. The bit that struck me as quirky was the mpol_* on
> the NULL vma. This pretty much eliminates the hidden dispatch, so I'm
> happy.
The allocate from next best node is orthogonal to hugetlb demand paging.
This should be merged once all the bugs are fixed and later when demand
paging goes in, we can add the mpol_* stuff.
- Ken
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: Hugepages demand paging V1 [4/4]: Numa patch
2004-10-22 19:37 ` Christoph Lameter
2004-10-22 19:40 ` William Lee Irwin III
@ 2004-10-25 21:05 ` Chen, Kenneth W
1 sibling, 0 replies; 11+ messages in thread
From: Chen, Kenneth W @ 2004-10-25 21:05 UTC (permalink / raw)
To: 'Christoph Lameter', William Lee Irwin III; +Cc: linux-kernel
Christoph Lameter wrote on Friday, October 22, 2004 12:37 PM
> > On Thu, Oct 21, 2004 at 09:58:54PM -0700, Christoph Lameter wrote:
> > > Changelog
> > > * NUMA enhancements (rough first implementation)
> > > * Do not begin search for huge page memory at the first node
> > > but start at the current node and then search previous and
> > > the following nodes for memory.
> > > Signed-off-by: Christoph Lameter <clameter@sgi.com>
> >
> > dequeue_huge_page() seems to want a nodemask, not a vma, though I
> > suppose it's not particularly pressing.
>
> How about this variation following __alloc_page:
>
> @@ -32,14 +32,17 @@
> + struct zonelist *zonelist = NODE_DATA(nid)->node_zonelists;
> + struct zone **zones = zonelist->zones;
> + struct zone *z;
> + int i;
> +
> + for(i=0; (z = zones[i])!= NULL; i++) {
> + nid = z->zone_pgdat->node_id;
> + if (list_empty(&hugepage_freelists[node_id]))
> + break;
> }
Must be typos in the if statement. Two fatal errors here: You don't
really mean to break out of the for loop if there are no hugetlb page
on that node, do you? The variable name to index into the freelist is
wrong, should be nid, otherwise this code won't compile. That line
should be this:
+ if (!list_empty(&hugepage_freelists[nid]))
Also this is generic code, we should consider scanning ZONE_HIGHMEM
zonelist. Otherwise, this will likely screw up x86 numa machine.
- Ken
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Hugepages demand paging V1 [4/4]: Numa patch
2004-10-22 19:37 ` Christoph Lameter
@ 2004-10-22 19:40 ` William Lee Irwin III
2004-10-25 21:25 ` Chen, Kenneth W
2004-10-25 21:05 ` Chen, Kenneth W
1 sibling, 1 reply; 11+ messages in thread
From: William Lee Irwin III @ 2004-10-22 19:40 UTC (permalink / raw)
To: Christoph Lameter; +Cc: Chen, Kenneth W, linux-kernel
On Fri, 22 Oct 2004, William Lee Irwin III wrote:
>> dequeue_huge_page() seems to want a nodemask, not a vma, though I
>> suppose it's not particularly pressing.
On Fri, Oct 22, 2004 at 12:37:13PM -0700, Christoph Lameter wrote:
> How about this variation following __alloc_page:
Looks reasonable. The bit that struck me as quirky was the mpol_* on
the NULL vma. This pretty much eliminates the hidden dispatch, so I'm
happy.
-- wli
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Hugepages demand paging V1 [4/4]: Numa patch
2004-10-22 11:00 ` William Lee Irwin III
@ 2004-10-22 19:37 ` Christoph Lameter
2004-10-22 19:40 ` William Lee Irwin III
2004-10-25 21:05 ` Chen, Kenneth W
0 siblings, 2 replies; 11+ messages in thread
From: Christoph Lameter @ 2004-10-22 19:37 UTC (permalink / raw)
To: William Lee Irwin III; +Cc: Chen, Kenneth W, linux-kernel
On Fri, 22 Oct 2004, William Lee Irwin III wrote:
> On Thu, Oct 21, 2004 at 09:58:54PM -0700, Christoph Lameter wrote:
> > Changelog
> > * NUMA enhancements (rough first implementation)
> > * Do not begin search for huge page memory at the first node
> > but start at the current node and then search previous and
> > the following nodes for memory.
> > Signed-off-by: Christoph Lameter <clameter@sgi.com>
>
> dequeue_huge_page() seems to want a nodemask, not a vma, though I
> suppose it's not particularly pressing.
How about this variation following __alloc_page:
Index: linux-2.6.9/mm/hugetlb.c
===================================================================
--- linux-2.6.9.orig/mm/hugetlb.c 2004-10-21 20:39:50.000000000 -0700
+++ linux-2.6.9/mm/hugetlb.c 2004-10-22 10:53:18.000000000 -0700
@@ -32,14 +32,17 @@
{
int nid = numa_node_id();
struct page *page = NULL;
-
- if (list_empty(&hugepage_freelists[nid])) {
- for (nid = 0; nid < MAX_NUMNODES; ++nid)
- if (!list_empty(&hugepage_freelists[nid]))
- break;
+ struct zonelist *zonelist = NODE_DATA(nid)->node_zonelists;
+ struct zone **zones = zonelist->zones;
+ struct zone *z;
+ int i;
+
+ for(i=0; (z = zones[i])!= NULL; i++) {
+ nid = z->zone_pgdat->node_id;
+ if (list_empty(&hugepage_freelists[node_id]))
+ break;
}
- if (nid >= 0 && nid < MAX_NUMNODES &&
- !list_empty(&hugepage_freelists[nid])) {
+ if (z) {
page = list_entry(hugepage_freelists[nid].next,
struct page, lru);
list_del(&page->lru);
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Hugepages demand paging V1 [4/4]: Numa patch
2004-10-22 4:58 ` Hugepages demand paging V1 [4/4]: Numa patch Christoph Lameter
2004-10-22 6:05 ` Chen, Kenneth W
@ 2004-10-22 11:00 ` William Lee Irwin III
2004-10-22 19:37 ` Christoph Lameter
1 sibling, 1 reply; 11+ messages in thread
From: William Lee Irwin III @ 2004-10-22 11:00 UTC (permalink / raw)
To: Christoph Lameter; +Cc: Chen, Kenneth W, raybry, linux-kernel
On Thu, Oct 21, 2004 at 09:58:54PM -0700, Christoph Lameter wrote:
> Changelog
> * NUMA enhancements (rough first implementation)
> * Do not begin search for huge page memory at the first node
> but start at the current node and then search previous and
> the following nodes for memory.
> Signed-off-by: Christoph Lameter <clameter@sgi.com>
dequeue_huge_page() seems to want a nodemask, not a vma, though I
suppose it's not particularly pressing.
> Index: linux-2.6.9/mm/hugetlb.c
> ===================================================================
> --- linux-2.6.9.orig/mm/hugetlb.c 2004-10-21 20:39:50.000000000 -0700
> +++ linux-2.6.9/mm/hugetlb.c 2004-10-21 20:44:12.000000000 -0700
> @@ -28,15 +28,30 @@
> free_huge_pages_node[nid]++;
> }
>
> -static struct page *dequeue_huge_page(void)
> +static struct page *dequeue_huge_page(struct vm_area_struct *vma, unsigned long addr)
> {
> int nid = numa_node_id();
> + int tid, nid2;
> struct page *page = NULL;
>
> if (list_empty(&hugepage_freelists[nid])) {
> - for (nid = 0; nid < MAX_NUMNODES; ++nid)
> - if (!list_empty(&hugepage_freelists[nid]))
> - break;
> + /* Prefer the neighboring nodes */
> + for (tid =1 ; tid < MAX_NUMNODES; tid++) {
> +
> + /* Is there space in a following node ? */
> + nid2 = (nid + tid) % MAX_NUMNODES;
> + if (mpol_node_valid(nid2, vma, addr) &&
> + !list_empty(&hugepage_freelists[nid2]))
> + break;
> +
> + /* or in an previous node ? */
> + if (tid > nid) continue;
> + nid2 = nid - tid;
> + if (mpol_node_valid(nid2, vma, addr) &&
> + !list_empty(&hugepage_freelists[nid2]))
> + break;
> + }
> + nid = nid2;
> }
> if (nid >= 0 && nid < MAX_NUMNODES &&
> !list_empty(&hugepage_freelists[nid])) {
> @@ -75,13 +90,13 @@
> spin_unlock(&hugetlb_lock);
> }
>
> -struct page *alloc_huge_page(void)
> +struct page *alloc_huge_page(struct vm_area_struct *vma, unsigned long addr)
> {
> struct page *page;
> int i;
>
> spin_lock(&hugetlb_lock);
> - page = dequeue_huge_page();
> + page = dequeue_huge_page(vma, addr);
> if (!page) {
> spin_unlock(&hugetlb_lock);
> return NULL;
> @@ -181,7 +196,7 @@
> spin_lock(&hugetlb_lock);
> try_to_free_low(count);
> while (count < nr_huge_pages) {
> - struct page *page = dequeue_huge_page();
> + struct page *page = dequeue_huge_page(NULL, 0);
> if (!page)
> break;
> update_and_free_page(page);
> @@ -255,7 +270,7 @@
> retry:
> page = find_get_page(mapping, idx);
> if (!page) {
> - page = alloc_huge_page();
> + page = alloc_huge_page(vma, addr);
> if (!page)
> /*
> * with strict overcommit accounting, we should never
> Index: linux-2.6.9/include/linux/hugetlb.h
> ===================================================================
> --- linux-2.6.9.orig/include/linux/hugetlb.h 2004-10-21 20:44:10.000000000 -0700
> +++ linux-2.6.9/include/linux/hugetlb.h 2004-10-21 20:44:56.000000000 -0700
> @@ -31,7 +31,7 @@
> pmd_t *pmd, int write);
> int is_aligned_hugepage_range(unsigned long addr, unsigned long len);
> int pmd_huge(pmd_t pmd);
> -struct page *alloc_huge_page(void);
> +struct page *alloc_huge_page(struct vm_area_struct *vma, unsigned long addr);
> void free_huge_page(struct page *);
>
> extern unsigned long max_huge_pages;
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: Hugepages demand paging V1 [4/4]: Numa patch
2004-10-22 4:58 ` Hugepages demand paging V1 [4/4]: Numa patch Christoph Lameter
@ 2004-10-22 6:05 ` Chen, Kenneth W
2004-10-22 11:00 ` William Lee Irwin III
1 sibling, 0 replies; 11+ messages in thread
From: Chen, Kenneth W @ 2004-10-22 6:05 UTC (permalink / raw)
To: 'Christoph Lameter'; +Cc: William Lee Irwin III, raybry, linux-kernel
Christoph Lameter wrote on Thursday, October 21, 2004 9:59 PM
> Changelog
> * NUMA enhancements (rough first implementation)
> * Do not begin search for huge page memory at the first node
> but start at the current node and then search previous and
> the following nodes for memory.
>
> -static struct page *dequeue_huge_page(void)
> +static struct page *dequeue_huge_page(struct vm_area_struct *vma, unsigned long addr)
> {
> int nid = numa_node_id();
> + int tid, nid2;
> struct page *page = NULL;
>
> if (list_empty(&hugepage_freelists[nid])) {
> - for (nid = 0; nid < MAX_NUMNODES; ++nid)
> - if (!list_empty(&hugepage_freelists[nid]))
> - break;
> + /* Prefer the neighboring nodes */
> + for (tid =1 ; tid < MAX_NUMNODES; tid++) {
> +
> + /* Is there space in a following node ? */
> + nid2 = (nid + tid) % MAX_NUMNODES;
> + if (mpol_node_valid(nid2, vma, addr) &&
> + !list_empty(&hugepage_freelists[nid2]))
> + break;
> +
> + /* or in an previous node ? */
> + if (tid > nid) continue;
> + nid2 = nid - tid;
> + if (mpol_node_valid(nid2, vma, addr) &&
> + !list_empty(&hugepage_freelists[nid2]))
> + break;
Are you sure about this? Looked flawed to me. Logical node number
does not directly correlate to numa memory hierarchy.
- Ken
^ permalink raw reply [flat|nested] 11+ messages in thread
* Hugepages demand paging V1 [4/4]: Numa patch
2004-10-22 4:55 ` Hugepages demand paging V1 [0/4]: Discussion and overview Christoph Lameter
@ 2004-10-22 4:58 ` Christoph Lameter
2004-10-22 6:05 ` Chen, Kenneth W
2004-10-22 11:00 ` William Lee Irwin III
0 siblings, 2 replies; 11+ messages in thread
From: Christoph Lameter @ 2004-10-22 4:58 UTC (permalink / raw)
To: Chen, Kenneth W; +Cc: William Lee Irwin III, raybry, linux-kernel
Changelog
* NUMA enhancements (rough first implementation)
* Do not begin search for huge page memory at the first node
but start at the current node and then search previous and
the following nodes for memory.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Index: linux-2.6.9/mm/hugetlb.c
===================================================================
--- linux-2.6.9.orig/mm/hugetlb.c 2004-10-21 20:39:50.000000000 -0700
+++ linux-2.6.9/mm/hugetlb.c 2004-10-21 20:44:12.000000000 -0700
@@ -28,15 +28,30 @@
free_huge_pages_node[nid]++;
}
-static struct page *dequeue_huge_page(void)
+static struct page *dequeue_huge_page(struct vm_area_struct *vma, unsigned long addr)
{
int nid = numa_node_id();
+ int tid, nid2;
struct page *page = NULL;
if (list_empty(&hugepage_freelists[nid])) {
- for (nid = 0; nid < MAX_NUMNODES; ++nid)
- if (!list_empty(&hugepage_freelists[nid]))
- break;
+ /* Prefer the neighboring nodes */
+ for (tid =1 ; tid < MAX_NUMNODES; tid++) {
+
+ /* Is there space in a following node ? */
+ nid2 = (nid + tid) % MAX_NUMNODES;
+ if (mpol_node_valid(nid2, vma, addr) &&
+ !list_empty(&hugepage_freelists[nid2]))
+ break;
+
+ /* or in an previous node ? */
+ if (tid > nid) continue;
+ nid2 = nid - tid;
+ if (mpol_node_valid(nid2, vma, addr) &&
+ !list_empty(&hugepage_freelists[nid2]))
+ break;
+ }
+ nid = nid2;
}
if (nid >= 0 && nid < MAX_NUMNODES &&
!list_empty(&hugepage_freelists[nid])) {
@@ -75,13 +90,13 @@
spin_unlock(&hugetlb_lock);
}
-struct page *alloc_huge_page(void)
+struct page *alloc_huge_page(struct vm_area_struct *vma, unsigned long addr)
{
struct page *page;
int i;
spin_lock(&hugetlb_lock);
- page = dequeue_huge_page();
+ page = dequeue_huge_page(vma, addr);
if (!page) {
spin_unlock(&hugetlb_lock);
return NULL;
@@ -181,7 +196,7 @@
spin_lock(&hugetlb_lock);
try_to_free_low(count);
while (count < nr_huge_pages) {
- struct page *page = dequeue_huge_page();
+ struct page *page = dequeue_huge_page(NULL, 0);
if (!page)
break;
update_and_free_page(page);
@@ -255,7 +270,7 @@
retry:
page = find_get_page(mapping, idx);
if (!page) {
- page = alloc_huge_page();
+ page = alloc_huge_page(vma, addr);
if (!page)
/*
* with strict overcommit accounting, we should never
Index: linux-2.6.9/include/linux/hugetlb.h
===================================================================
--- linux-2.6.9.orig/include/linux/hugetlb.h 2004-10-21 20:44:10.000000000 -0700
+++ linux-2.6.9/include/linux/hugetlb.h 2004-10-21 20:44:56.000000000 -0700
@@ -31,7 +31,7 @@
pmd_t *pmd, int write);
int is_aligned_hugepage_range(unsigned long addr, unsigned long len);
int pmd_huge(pmd_t pmd);
-struct page *alloc_huge_page(void);
+struct page *alloc_huge_page(struct vm_area_struct *vma, unsigned long addr);
void free_huge_page(struct page *);
extern unsigned long max_huge_pages;
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2004-10-27 20:58 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <B05667366EE6204181EABE9C1B1C0EB504BFA479@scsmsx401.amr.corp.intel.com>
2004-10-27 17:57 ` Hugepages demand paging V1 [4/4]: Numa patch Christoph Lameter
2004-10-27 20:53 ` Chen, Kenneth W
[not found] <B05667366EE6204181EABE9C1B1C0EB501F2ADFB@scsmsx401.amr.corp.intel.com>
2004-10-22 4:55 ` Hugepages demand paging V1 [0/4]: Discussion and overview Christoph Lameter
2004-10-22 4:58 ` Hugepages demand paging V1 [4/4]: Numa patch Christoph Lameter
2004-10-22 6:05 ` Chen, Kenneth W
2004-10-22 11:00 ` William Lee Irwin III
2004-10-22 19:37 ` Christoph Lameter
2004-10-22 19:40 ` William Lee Irwin III
2004-10-25 21:25 ` Chen, Kenneth W
2004-10-25 21:52 ` William Lee Irwin III
2004-10-25 21:55 ` William Lee Irwin III
2004-10-25 21:05 ` Chen, Kenneth W
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®