* Re: [PATCH 2/3][RFC] Containers: Pagecache controller accounting
@ 2007-03-06 8:28 Vaidyanathan Srinivasan
0 siblings, 0 replies; 3+ messages in thread
From: Vaidyanathan Srinivasan @ 2007-03-06 8:28 UTC (permalink / raw)
To: Linux Kernel, linux-mm
Cc: Vaidyanathan Srinivasan, ckrm-tech, Balbir Singh,
Srivatsa Vaddagiri, devel, xemul, Paul Menage, Christoph Lameter,
Rik van Riel
References: <45ED251C.2010400@linux.vnet.ibm.com>
In-Reply-To: <45ED251C.2010400@linux.vnet.ibm.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
The accounting framework works by adding a container pointer in
address_space structure. Each page in pagecache belongs to a
radix tree within the address_space structure corresponding to the inode.
In order to charge the container for pagecache usage, the corresponding
address_space is obtained from struct page which holds the container pointer.
This framework avoids any additional pointers in struct page.
additions and deletions from pagecache are hooked to charge and uncharge
the corresponding container.
Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
---
include/linux/fs.h | 4 ++++
mm/filemap.c | 8 ++++++++
2 files changed, 12 insertions(+)
--- linux-2.6.20.orig/include/linux/fs.h
+++ linux-2.6.20/include/linux/fs.h
@@ -447,6 +447,10 @@ struct address_space {
spinlock_t private_lock; /* for use by the address_space */
struct list_head private_list; /* ditto */
struct address_space *assoc_mapping; /* ditto */
+#ifdef CONFIG_CONTAINER_PAGECACHE_ACCT
+ struct container *container; /* Charge page to the right container
+ using page->mapping */
+#endif
} __attribute__((aligned(sizeof(long))));
/*
* On most architectures that alignment is already the case; but
--- linux-2.6.20.orig/mm/filemap.c
+++ linux-2.6.20/mm/filemap.c
@@ -30,6 +30,7 @@
#include <linux/security.h>
#include <linux/syscalls.h>
#include <linux/cpuset.h>
+#include <linux/pagecache_acct.h>
#include "filemap.h"
#include "internal.h"
@@ -117,6 +118,8 @@ void __remove_from_page_cache(struct pag
struct address_space *mapping = page->mapping;
radix_tree_delete(&mapping->page_tree, page->index);
+ /* Uncharge before the mapping is gone */
+ pagecache_acct_uncharge(page);
page->mapping = NULL;
mapping->nrpages--;
__dec_zone_page_state(page, NR_FILE_PAGES);
@@ -451,6 +454,11 @@ int add_to_page_cache(struct page *page,
__inc_zone_page_state(page, NR_FILE_PAGES);
}
write_unlock_irq(&mapping->tree_lock);
+ /* Unlock before charge, because we may reclaim this inline */
+ if (!error) {
+ pagecache_acct_init_page_ptr(page);
+ pagecache_acct_charge(page);
+ }
radix_tree_preload_end();
}
return error;
--
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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/3][RFC] Containers: Pagecache controller accounting
2007-03-05 14:52 [PATCH 0/3][RFC] Containers: Pagecache accounting and control subsystem (v1) Vaidyanathan Srinivasan
@ 2007-03-05 14:52 ` Vaidyanathan Srinivasan
0 siblings, 0 replies; 3+ messages in thread
From: Vaidyanathan Srinivasan @ 2007-03-05 14:52 UTC (permalink / raw)
To: linux-kernel, linux-mm
Cc: balbir, vatsa, ckrm-tech, devel, xemul, menage, clameter, riel,
Vaidyanathan Srinivasan
[-- Attachment #1: pagecache-controller-acct.patch --]
[-- Type: text/plain, Size: 2427 bytes --]
The accounting framework works by adding a container pointer in
address_space structure. Each page in pagecache belongs to a
radix tree within the address_space structure corresponding to the inode.
In order to charge the container for pagecache usage, the corresponding
address_space is obtained from struct page which holds the container pointer.
This framework avoids any additional pointers in struct page.
additions and deletions from pagecache are hooked to charge and uncharge
the corresponding container.
Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
---
include/linux/fs.h | 4 ++++
mm/filemap.c | 8 ++++++++
2 files changed, 12 insertions(+)
--- linux-2.6.20.orig/include/linux/fs.h
+++ linux-2.6.20/include/linux/fs.h
@@ -447,6 +447,10 @@ struct address_space {
spinlock_t private_lock; /* for use by the address_space */
struct list_head private_list; /* ditto */
struct address_space *assoc_mapping; /* ditto */
+#ifdef CONFIG_CONTAINER_PAGECACHE_ACCT
+ struct container *container; /* Charge page to the right container
+ using page->mapping */
+#endif
} __attribute__((aligned(sizeof(long))));
/*
* On most architectures that alignment is already the case; but
--- linux-2.6.20.orig/mm/filemap.c
+++ linux-2.6.20/mm/filemap.c
@@ -30,6 +30,7 @@
#include <linux/security.h>
#include <linux/syscalls.h>
#include <linux/cpuset.h>
+#include <linux/pagecache_acct.h>
#include "filemap.h"
#include "internal.h"
@@ -117,6 +118,8 @@ void __remove_from_page_cache(struct pag
struct address_space *mapping = page->mapping;
radix_tree_delete(&mapping->page_tree, page->index);
+ /* Uncharge before the mapping is gone */
+ pagecache_acct_uncharge(page);
page->mapping = NULL;
mapping->nrpages--;
__dec_zone_page_state(page, NR_FILE_PAGES);
@@ -451,6 +454,11 @@ int add_to_page_cache(struct page *page,
__inc_zone_page_state(page, NR_FILE_PAGES);
}
write_unlock_irq(&mapping->tree_lock);
+ /* Unlock before charge, because we may reclaim this inline */
+ if (!error) {
+ pagecache_acct_init_page_ptr(page);
+ pagecache_acct_charge(page);
+ }
radix_tree_preload_end();
}
return error;
--
--
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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/3][RFC] Containers: Pagecache controller accounting
2007-02-21 14:24 [PATCH 0/3][RFC] Containers: Pagecache accounting and control subsystem (v1) Vaidyanathan Srinivasan
@ 2007-02-21 14:24 ` Vaidyanathan Srinivasan
0 siblings, 0 replies; 3+ messages in thread
From: Vaidyanathan Srinivasan @ 2007-02-21 14:24 UTC (permalink / raw)
To: linux-kernel, linux-mm
Cc: balbir, vatsa, ckrm-tech, devel, xemul, menage, clameter, riel,
Vaidyanathan Srinivasan
[-- Attachment #1: pagecache-controller-acct.patch --]
[-- Type: text/plain, Size: 2427 bytes --]
The accounting framework works by adding a container pointer in
address_space structure. Each page in pagecache belongs to a
radix tree within the address_space structure corresponding to the inode.
In order to charge the container for pagecache usage, the corresponding
address_space is obtained from struct page which holds the container pointer.
This framework avoids any additional pointers in struct page.
additions and deletions from pagecache are hooked to charge and uncharge
the corresponding container.
Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
---
include/linux/fs.h | 4 ++++
mm/filemap.c | 8 ++++++++
2 files changed, 12 insertions(+)
--- linux-2.6.20.orig/include/linux/fs.h
+++ linux-2.6.20/include/linux/fs.h
@@ -447,6 +447,10 @@ struct address_space {
spinlock_t private_lock; /* for use by the address_space */
struct list_head private_list; /* ditto */
struct address_space *assoc_mapping; /* ditto */
+#ifdef CONFIG_CONTAINER_PAGECACHE_ACCT
+ struct container *container; /* Charge page to the right container
+ using page->mapping */
+#endif
} __attribute__((aligned(sizeof(long))));
/*
* On most architectures that alignment is already the case; but
--- linux-2.6.20.orig/mm/filemap.c
+++ linux-2.6.20/mm/filemap.c
@@ -30,6 +30,7 @@
#include <linux/security.h>
#include <linux/syscalls.h>
#include <linux/cpuset.h>
+#include <linux/pagecache_acct.h>
#include "filemap.h"
#include "internal.h"
@@ -117,6 +118,8 @@ void __remove_from_page_cache(struct pag
struct address_space *mapping = page->mapping;
radix_tree_delete(&mapping->page_tree, page->index);
+ /* Uncharge before the mapping is gone */
+ pagecache_acct_uncharge(page);
page->mapping = NULL;
mapping->nrpages--;
__dec_zone_page_state(page, NR_FILE_PAGES);
@@ -451,6 +454,11 @@ int add_to_page_cache(struct page *page,
__inc_zone_page_state(page, NR_FILE_PAGES);
}
write_unlock_irq(&mapping->tree_lock);
+ /* Unlock before charge, because we may reclaim this inline */
+ if (!error) {
+ pagecache_acct_init_page_ptr(page);
+ pagecache_acct_charge(page);
+ }
radix_tree_preload_end();
}
return error;
--
--
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>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-03-06 8:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-06 8:28 [PATCH 2/3][RFC] Containers: Pagecache controller accounting Vaidyanathan Srinivasan
-- strict thread matches above, loose matches on Subject: below --
2007-03-05 14:52 [PATCH 0/3][RFC] Containers: Pagecache accounting and control subsystem (v1) Vaidyanathan Srinivasan
2007-03-05 14:52 ` [PATCH 2/3][RFC] Containers: Pagecache controller accounting Vaidyanathan Srinivasan
2007-02-21 14:24 [PATCH 0/3][RFC] Containers: Pagecache accounting and control subsystem (v1) Vaidyanathan Srinivasan
2007-02-21 14:24 ` [PATCH 2/3][RFC] Containers: Pagecache controller accounting Vaidyanathan Srinivasan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox