Skip to contentSkip to conversation

mm: page_alloc: Avoid marking zones full prematurely after zone_reclaim()

PATCH In review Mel Gorman 5 participants 16 messages Mar 20, 2013 – Apr 10, 2013

Subsystems (2)
lore
Share & tools
lore

Mel Gorman

author
#0 lore raw

PATCH 1/1 mm: page_alloc: Avoid marking zones full prematurely after zone_reclaim()

The following problem was reported against a distribution kernel when zone_reclaim was enabled but the same problem applies to the mainline kernel. The reproduction case was as follows

1. Run numactl -m +0 dd if=largefile of=/dev/null This allocates a large number of clean pages in node 0

2. numactl -N +0 memhog 0.5*Mg
This start a memory-using application in node 0.

The expected behaviour is that the clean pages get reclaimed and the application uses node 0 for its memory. The observed behaviour was that the memory for the memhog application was allocated off-node since commits cd38b11 (mm: page allocator: initialise ZLC for first zone eligible for zone_reclaim) and commit 76d3fbf (mm: page allocator: reconsider zones for allocation after direct reclaim).

The assumption of those patches was that it was always preferable to allocate quickly than stall for long periods of time and they were meant to take care that the zone was only marked full when necessary but an important case was missed.

In the allocator fast path, only the low watermarks are checked. If the zones free pages are between the low and min watermark then allocations from the allocators slow path will succeed. However, zone_reclaim will only reclaim SWAP_CLUSTER_MAX or 1<<order pages. There is no guarantee that this will meet the low watermark causing the zone to be marked full prematurely.

This patch will only mark the zone full after zone_reclaim if it the min watermarks are checked or if page reclaim failed to make sufficient progress.

---
 mm/page_alloc.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
mm/page_alloc.c +16 -1
index 8fcced7..adce823 100644
@@ -1940,9 +1940,24 @@ zonelist_scan:
 				continue;
 			default:
 				/* did we reclaim enough */
-				if (!zone_watermark_ok(zone, order, mark,
+				if (zone_watermark_ok(zone, order, mark,
 						classzone_idx, alloc_flags))
+					goto try_this_zone;
+
+				/*
+				 * Failed to reclaim enough to meet watermark.
+				 * Only mark the zone full if checking the min
+				 * watermark or if we failed to reclaim just
+				 * 1<<order pages or else the page allocator
+				 * fastpath will prematurely mark zones full
+				 * when the watermark is between the low and
+				 * min watermarks.
+				 */
+				if ((alloc_flags & ALLOC_WMARK_MIN) ||
+				    ret == ZONE_RECLAIM_SOME)
 					goto this_zone_full;
+
+				continue;
 			}
 		}
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Reviewed-by on v1 1/1
#1 lore raw
Quoted 29 lines · Mel Gorman

The following problem was reported against a distribution kernel when zone_reclaim was enabled but the same problem applies to the mainline kernel. The reproduction case was as follows

1. Run numactl -m +0 dd if=largefile of=/dev/null This allocates a large number of clean pages in node 0

2. numactl -N +0 memhog 0.5*Mg
This start a memory-using application in node 0.

The expected behaviour is that the clean pages get reclaimed and the application uses node 0 for its memory. The observed behaviour was that the memory for the memhog application was allocated off-node since commits cd38b11 (mm: page allocator: initialise ZLC for first zone eligible for zone_reclaim) and commit 76d3fbf (mm: page allocator: reconsider zones for allocation after direct reclaim).

The assumption of those patches was that it was always preferable to allocate quickly than stall for long periods of time and they were meant to take care that the zone was only marked full when necessary but an important case was missed.

In the allocator fast path, only the low watermarks are checked. If the zones free pages are between the low and min watermark then allocations from the allocators slow path will succeed. However, zone_reclaim will only reclaim SWAP_CLUSTER_MAX or 1<<order pages. There is no guarantee that this will meet the low watermark causing the zone to be marked full prematurely.

Quoted 6 lines

This patch will only mark the zone full after zone_reclaim if it the min watermarks are checked or if page reclaim failed to make sufficient progress.

Quoted 34 lines
---
 mm/page_alloc.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
mm/page_alloc.c +16 -1
index 8fcced7..adce823 100644
@@ -1940,9 +1940,24 @@ zonelist_scan:
 				continue;
 			default:
 				/* did we reclaim enough */
-				if (!zone_watermark_ok(zone, order, mark,
+				if (zone_watermark_ok(zone, order, mark,
 						classzone_idx, alloc_flags))
+					goto try_this_zone;
+
+				/*
+				 * Failed to reclaim enough to meet watermark.
+				 * Only mark the zone full if checking the min
+				 * watermark or if we failed to reclaim just
+				 * 1<<order pages or else the page allocator
+				 * fastpath will prematurely mark zones full
+				 * when the watermark is between the low and
+				 * min watermarks.
+				 */
+				if ((alloc_flags & ALLOC_WMARK_MIN) ||
+				    ret == ZONE_RECLAIM_SOME)
 					goto this_zone_full;
+
+				continue;
 			}
 		}
 
Signature · 8 lines
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Reviewed-by on v1 1/1
#2 lore raw
In reply to Mel Gorman
Quoted 29 lines · Mel Gorman

The following problem was reported against a distribution kernel when zone_reclaim was enabled but the same problem applies to the mainline kernel. The reproduction case was as follows

1. Run numactl -m +0 dd if=largefile of=/dev/null This allocates a large number of clean pages in node 0

2. numactl -N +0 memhog 0.5*Mg
This start a memory-using application in node 0.

The expected behaviour is that the clean pages get reclaimed and the application uses node 0 for its memory. The observed behaviour was that the memory for the memhog application was allocated off-node since commits cd38b11 (mm: page allocator: initialise ZLC for first zone eligible for zone_reclaim) and commit 76d3fbf (mm: page allocator: reconsider zones for allocation after direct reclaim).

The assumption of those patches was that it was always preferable to allocate quickly than stall for long periods of time and they were meant to take care that the zone was only marked full when necessary but an important case was missed.

In the allocator fast path, only the low watermarks are checked. If the zones free pages are between the low and min watermark then allocations from the allocators slow path will succeed. However, zone_reclaim will only reclaim SWAP_CLUSTER_MAX or 1<<order pages. There is no guarantee that this will meet the low watermark causing the zone to be marked full prematurely.

Quoted 6 lines

This patch will only mark the zone full after zone_reclaim if it the min watermarks are checked or if page reclaim failed to make sufficient progress.

Quoted 36 lines

---
mm/page_alloc.c | 17 ++++++++++++++++-

1 file changed, 16 insertions(+), 1 deletion(-)
mm/page_alloc.c +16 -2
index 8fcced7..adce823 100644
@@ -1940,9 +1940,24 @@ zonelist_scan:
 				continue;
 			default:
 				/* did we reclaim enough */
-				if (!zone_watermark_ok(zone, order, mark,
+				if (zone_watermark_ok(zone, order, mark,
 						classzone_idx, alloc_flags))
+					goto try_this_zone;
+
+				/*
+				 * Failed to reclaim enough to meet watermark.
+				 * Only mark the zone full if checking the min
+				 * watermark or if we failed to reclaim just
+				 * 1<<order pages or else the page allocator
+				 * fastpath will prematurely mark zones full
+				 * when the watermark is between the low and
+				 * min watermarks.
+				 */
+				if ((alloc_flags & ALLOC_WMARK_MIN) ||
+				    ret == ZONE_RECLAIM_SOME)
 					goto this_zone_full;
+
+				continue;
 			}
 		}
 
 
--
Quoted 4 lines

To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Reviewed-by on v1 1/1
#3 lore raw
In reply to Mel Gorman
Quoted 29 lines · Mel Gorman

The following problem was reported against a distribution kernel when zone_reclaim was enabled but the same problem applies to the mainline kernel. The reproduction case was as follows

1. Run numactl -m +0 dd if=largefile of=/dev/null This allocates a large number of clean pages in node 0

2. numactl -N +0 memhog 0.5*Mg
This start a memory-using application in node 0.

The expected behaviour is that the clean pages get reclaimed and the application uses node 0 for its memory. The observed behaviour was that the memory for the memhog application was allocated off-node since commits cd38b11 (mm: page allocator: initialise ZLC for first zone eligible for zone_reclaim) and commit 76d3fbf (mm: page allocator: reconsider zones for allocation after direct reclaim).

The assumption of those patches was that it was always preferable to allocate quickly than stall for long periods of time and they were meant to take care that the zone was only marked full when necessary but an important case was missed.

In the allocator fast path, only the low watermarks are checked. If the zones free pages are between the low and min watermark then allocations from the allocators slow path will succeed. However, zone_reclaim will only reclaim SWAP_CLUSTER_MAX or 1<<order pages. There is no guarantee that this will meet the low watermark causing the zone to be marked full prematurely.

Quoted 6 lines

This patch will only mark the zone full after zone_reclaim if it the min watermarks are checked or if page reclaim failed to make sufficient progress.

Quoted 36 lines

---
mm/page_alloc.c | 17 ++++++++++++++++-

1 file changed, 16 insertions(+), 1 deletion(-)
mm/page_alloc.c +16 -2
index 8fcced7..adce823 100644
@@ -1940,9 +1940,24 @@ zonelist_scan:
 				continue;
 			default:
 				/* did we reclaim enough */
-				if (!zone_watermark_ok(zone, order, mark,
+				if (zone_watermark_ok(zone, order, mark,
 						classzone_idx, alloc_flags))
+					goto try_this_zone;
+
+				/*
+				 * Failed to reclaim enough to meet watermark.
+				 * Only mark the zone full if checking the min
+				 * watermark or if we failed to reclaim just
+				 * 1<<order pages or else the page allocator
+				 * fastpath will prematurely mark zones full
+				 * when the watermark is between the low and
+				 * min watermarks.
+				 */
+				if ((alloc_flags & ALLOC_WMARK_MIN) ||
+				    ret == ZONE_RECLAIM_SOME)
 					goto this_zone_full;
+
+				continue;
 			}
 		}
 
 
--
Quoted 4 lines

To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#4 lore raw
In reply to Mel Gorman

Hi Mel,

Quoted 6 lines · Mel Gorman

The following problem was reported against a distribution kernel when zone_reclaim was enabled but the same problem applies to the mainline kernel. The reproduction case was as follows

1. Run numactl -m +0 dd if=largefile of=/dev/null This allocates a large number of clean pages in node 0

I confuse why this need allocate a large number of clean pages?

Quoted 65 lines

2. numactl -N +0 memhog 0.5*Mg
This start a memory-using application in node 0.

The expected behaviour is that the clean pages get reclaimed and the application uses node 0 for its memory. The observed behaviour was that the memory for the memhog application was allocated off-node since commits cd38b11 (mm: page allocator: initialise ZLC for first zone eligible for zone_reclaim) and commit 76d3fbf (mm: page allocator: reconsider zones for allocation after direct reclaim).

The assumption of those patches was that it was always preferable to allocate quickly than stall for long periods of time and they were meant to take care that the zone was only marked full when necessary but an important case was missed.

In the allocator fast path, only the low watermarks are checked. If the zones free pages are between the low and min watermark then allocations from the allocators slow path will succeed. However, zone_reclaim will only reclaim SWAP_CLUSTER_MAX or 1<<order pages. There is no guarantee that this will meet the low watermark causing the zone to be marked full prematurely.

This patch will only mark the zone full after zone_reclaim if it the min watermarks are checked or if page reclaim failed to make sufficient progress.

---
  mm/page_alloc.c | 17 ++++++++++++++++-
  1 file changed, 16 insertions(+), 1 deletion(-)
mm/page_alloc.c +16 -2
index 8fcced7..adce823 100644
@@ -1940,9 +1940,24 @@ zonelist_scan:
  				continue;
  			default:
  				/* did we reclaim enough */
-				if (!zone_watermark_ok(zone, order, mark,
+				if (zone_watermark_ok(zone, order, mark,
  						classzone_idx, alloc_flags))
+					goto try_this_zone;
+
+				/*
+				 * Failed to reclaim enough to meet watermark.
+				 * Only mark the zone full if checking the min
+				 * watermark or if we failed to reclaim just
+				 * 1<<order pages or else the page allocator
+				 * fastpath will prematurely mark zones full
+				 * when the watermark is between the low and
+				 * min watermarks.
+				 */
+				if ((alloc_flags & ALLOC_WMARK_MIN) ||
+				    ret == ZONE_RECLAIM_SOME)
  					goto this_zone_full;
+
+				continue;
  			}
  		}
 
 
--
Quoted 4 lines

To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#5 lore raw
Quoted 10 lines · Simon Jeons

Hi Mel,

Quoted 6 lines · Mel Gorman

The following problem was reported against a distribution kernel when zone_reclaim was enabled but the same problem applies to the mainline kernel. The reproduction case was as follows

1. Run numactl -m +0 dd if=largefile of=/dev/null This allocates a large number of clean pages in node 0

I confuse why this need allocate a large number of clean pages?

It reads from file and puts pages into the page cache. The pages are not modified so they are clean. Output file is /dev/null so no pages are written. dd doesn't call fadvise(POSIX_FADV_DONTNEED) on the input file by default so pages from the file stay in the page cache

Signature · 8 lines
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#6 lore raw

Hi Michal,

Quoted 7 lines · Michal Hocko
Quoted 6 lines · Simon Jeons

Hi Mel,

Quoted 4 lines · Mel Gorman

The following problem was reported against a distribution kernel when zone_reclaim was enabled but the same problem applies to the mainline kernel. The reproduction case was as follows

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

1. Run numactl -m +0 dd if=largefile of=/dev/null This allocates a large number of clean pages in node 0

I confuse why this need allocate a large number of clean pages?

It reads from file and puts pages into the page cache. The pages are not modified so they are clean. Output file is /dev/null so no pages are written. dd doesn't call fadvise(POSIX_FADV_DONTNEED) on the input file by default so pages from the file stay in the page cache

Thanks for your clarify Michal.
dd will use page cache instead of direct IO? Where can I got dd source codes? One offline question, when should use page cache and when should use direct IO?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#7 lore raw
Quoted 11 lines · Simon Jeons

Hi Michal,

Quoted 9 lines · Michal Hocko
Quoted 8 lines · Simon Jeons

Hi Mel,

Quoted 6 lines · Mel Gorman

The following problem was reported against a distribution kernel when zone_reclaim was enabled but the same problem applies to the mainline kernel. The reproduction case was as follows

1. Run numactl -m +0 dd if=largefile of=/dev/null This allocates a large number of clean pages in node 0

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

I confuse why this need allocate a large number of clean pages?

It reads from file and puts pages into the page cache. The pages are not modified so they are clean. Output file is /dev/null so no pages are written. dd doesn't call fadvise(POSIX_FADV_DONTNEED) on the input file by default so pages from the file stay in the page cache

Thanks for your clarify Michal.

This is getting off-topic.

Quoted 1 line

dd will use page cache instead of direct IO?

no by default. You can use direct option. Refer to man dd for more information.

Quoted 1 line

Where can I got dd source codes?

dd is part of coreutils: http://www.gnu.org/software/coreutils/
Please do not be afraid to use google. Most of these answers are there already...

Quoted 2 lines

One offline question, when should use page cache and when should use direct IO?

And this is really off-topic. The simplest answer would be. Use direct IO when you want to prevent from caching because you are doing it yourselvef. Please try to search the web it is full of more specific examples.

Signature · 8 lines
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#8 lore raw
In reply to Simon Jeons
Quoted 17 lines · Simon Jeons

Hi Michal,

Quoted 7 lines · Michal Hocko
Quoted 6 lines · Simon Jeons

Hi Mel,

Quoted 4 lines · Mel Gorman

The following problem was reported against a distribution kernel when zone_reclaim was enabled but the same problem applies to the mainline kernel. The reproduction case was as follows

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

1. Run numactl -m +0 dd if=largefile of=/dev/null This allocates a large number of clean pages in node 0

I confuse why this need allocate a large number of clean pages?

It reads from file and puts pages into the page cache. The pages are not modified so they are clean. Output file is /dev/null so no pages are written. dd doesn't call fadvise(POSIX_FADV_DONTNEED) on the input file by default so pages from the file stay in the page cache

Quoted 5 lines

Thanks for your clarify Michal.
dd will use page cache instead of direct IO? Where can I got dd source codes?
One offline question, when should use page cache and when should use direct IO?

who prefer direct IO:
- the users believe they can manage caching of file contents better than the kernel can.
- the users want to avoid overflowing the page cache with data which is unlikely to be of use in the near future.

Regards,
Wanpeng Li

Quoted 7 lines

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#9 lore raw
In reply to Simon Jeons
Quoted 17 lines · Simon Jeons

Hi Michal,

Quoted 7 lines · Michal Hocko
Quoted 6 lines · Simon Jeons

Hi Mel,

Quoted 4 lines · Mel Gorman

The following problem was reported against a distribution kernel when zone_reclaim was enabled but the same problem applies to the mainline kernel. The reproduction case was as follows

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

1. Run numactl -m +0 dd if=largefile of=/dev/null This allocates a large number of clean pages in node 0

I confuse why this need allocate a large number of clean pages?

It reads from file and puts pages into the page cache. The pages are not modified so they are clean. Output file is /dev/null so no pages are written. dd doesn't call fadvise(POSIX_FADV_DONTNEED) on the input file by default so pages from the file stay in the page cache

Quoted 5 lines

Thanks for your clarify Michal.
dd will use page cache instead of direct IO? Where can I got dd source codes?
One offline question, when should use page cache and when should use direct IO?

who prefer direct IO:
- the users believe they can manage caching of file contents better than the kernel can.
- the users want to avoid overflowing the page cache with data which is unlikely to be of use in the near future.

Regards,
Wanpeng Li

Quoted 7 lines

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#10 lore raw
In reply to Michal Hocko

Hi Michal,

Quoted 7 lines · Michal Hocko
Quoted 6 lines · Simon Jeons

Hi Mel,

Quoted 4 lines · Mel Gorman

The following problem was reported against a distribution kernel when zone_reclaim was enabled but the same problem applies to the mainline kernel. The reproduction case was as follows

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

1. Run numactl -m +0 dd if=largefile of=/dev/null This allocates a large number of clean pages in node 0

I confuse why this need allocate a large number of clean pages?

It reads from file and puts pages into the page cache. The pages are not modified so they are clean. Output file is /dev/null so no pages are written. dd doesn't call fadvise(POSIX_FADV_DONTNEED) on the input file by default so pages from the file stay in the page cache

I try this in v3.9-rc5:
dd if=/dev/sda of=/dev/null bs=1MB
14813+0 records in
14812+0 records out
14812000000 bytes (15 GB) copied, 105.988 s, 140 MB/s

free -m -s 1

total used free shared buffers
cached

Mem:          7912       1181       6731          0 663        239
-/+ buffers/cache:        277       7634
Swap:         8011          0       8011

It seems that almost 15GB copied before I stop dd, but the used pages which I monitor during dd always around 1200MB. Weird, why?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#11 lore raw

Ping!

Quoted 25 lines · Simon Jeons

Hi Michal,

Quoted 7 lines · Michal Hocko
Quoted 6 lines · Simon Jeons

Hi Mel,

Quoted 4 lines · Mel Gorman

The following problem was reported against a distribution kernel when zone_reclaim was enabled but the same problem applies to the mainline kernel. The reproduction case was as follows

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

1. Run numactl -m +0 dd if=largefile of=/dev/null This allocates a large number of clean pages in node 0

I confuse why this need allocate a large number of clean pages?

It reads from file and puts pages into the page cache. The pages are not modified so they are clean. Output file is /dev/null so no pages are written. dd doesn't call fadvise(POSIX_FADV_DONTNEED) on the input file by default so pages from the file stay in the page cache

I try this in v3.9-rc5:
dd if=/dev/sda of=/dev/null bs=1MB
14813+0 records in
14812+0 records out
14812000000 bytes (15 GB) copied, 105.988 s, 140 MB/s

free -m -s 1

Quoted 8 lines

total used free shared buffers
cached

Mem:          7912       1181       6731          0 663        239
-/+ buffers/cache:        277       7634
Swap:         8011          0       8011

It seems that almost 15GB copied before I stop dd, but the used pages which I monitor during dd always around 1200MB. Weird, why?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#12 lore raw
In reply to Simon Jeons

Hi Michal,

Quoted 25 lines · Simon Jeons

Hi Michal,

Quoted 7 lines · Michal Hocko
Quoted 6 lines · Simon Jeons

Hi Mel,

Quoted 4 lines · Mel Gorman

The following problem was reported against a distribution kernel when zone_reclaim was enabled but the same problem applies to the mainline kernel. The reproduction case was as follows

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

1. Run numactl -m +0 dd if=largefile of=/dev/null This allocates a large number of clean pages in node 0

I confuse why this need allocate a large number of clean pages?

It reads from file and puts pages into the page cache. The pages are not modified so they are clean. Output file is /dev/null so no pages are written. dd doesn't call fadvise(POSIX_FADV_DONTNEED) on the input file by default so pages from the file stay in the page cache

I try this in v3.9-rc5:
dd if=/dev/sda of=/dev/null bs=1MB
14813+0 records in
14812+0 records out
14812000000 bytes (15 GB) copied, 105.988 s, 140 MB/s

free -m -s 1

Quoted 8 lines

total used free shared buffers
cached

Mem:          7912       1181       6731          0 663        239
-/+ buffers/cache:        277       7634
Swap:         8011          0       8011

It seems that almost 15GB copied before I stop dd, but the used pages which I monitor during dd always around 1200MB. Weird, why?

Sorry for waste your time, but the test result is weird, is it?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#13 lore raw

On Tue 09-04-13 18:05:30, Simon Jeons wrote:
[...]

Quoted 14 lines
Quoted 14 lines

I try this in v3.9-rc5:
dd if=/dev/sda of=/dev/null bs=1MB
14813+0 records in
14812+0 records out
14812000000 bytes (15 GB) copied, 105.988 s, 140 MB/s

free -m -s 1

total used free shared buffers
cached

Mem:          7912       1181       6731          0 663        239
-/+ buffers/cache:        277       7634
Swap:         8011          0       8011
Quoted 5 lines
Quoted 3 lines

It seems that almost 15GB copied before I stop dd, but the used pages which I monitor during dd always around 1200MB. Weird, why?

Sorry for waste your time, but the test result is weird, is it?

I am not sure which values you have been watching but you have to realize that you are reading a _partition_ not a file and those pages go into buffers rather than the page chache.

Signature · 8 lines
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#14 lore raw

Hi Michal,

Quoted 16 lines · Michal Hocko

On Tue 09-04-13 18:05:30, Simon Jeons wrote:
[...]

Quoted 14 lines
Quoted 14 lines

I try this in v3.9-rc5:
dd if=/dev/sda of=/dev/null bs=1MB
14813+0 records in
14812+0 records out
14812000000 bytes (15 GB) copied, 105.988 s, 140 MB/s

free -m -s 1

total used free shared buffers
cached

Mem:          7912       1181       6731          0 663        239
-/+ buffers/cache:        277       7634
Swap:         8011          0       8011
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines

It seems that almost 15GB copied before I stop dd, but the used pages which I monitor during dd always around 1200MB. Weird, why?

Sorry for waste your time, but the test result is weird, is it?

I am not sure which values you have been watching but you have to realize that you are reading a _partition_ not a file and those pages go into buffers rather than the page chache.

buffer cache are contained in page cache, is it? Which value I should watch?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#15 lore raw
In reply to Michal Hocko

Hi Michal,

Quoted 16 lines · Michal Hocko

On Tue 09-04-13 18:05:30, Simon Jeons wrote:
[...]

Quoted 14 lines
Quoted 14 lines

I try this in v3.9-rc5:
dd if=/dev/sda of=/dev/null bs=1MB
14813+0 records in
14812+0 records out
14812000000 bytes (15 GB) copied, 105.988 s, 140 MB/s

free -m -s 1

total used free shared buffers
cached

Mem:          7912       1181       6731          0 663        239
-/+ buffers/cache:        277       7634
Swap:         8011          0       8011
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines

It seems that almost 15GB copied before I stop dd, but the used pages which I monitor during dd always around 1200MB. Weird, why?

Sorry for waste your time, but the test result is weird, is it?

I am not sure which values you have been watching but you have to realize that you are reading a _partition_ not a file and those pages go into buffers rather than the page chache.

Interesting. ;-)

What's the difference between buffers and page cache? Why buffers don't grow?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>