From: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> To: Linux Kernel <linux-kernel@vger.kernel.org>, linux-mm@kvack.org Cc: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>, ckrm-tech@lists.sourceforge.net, Balbir Singh <balbir@in.ibm.com>, Srivatsa Vaddagiri <vatsa@in.ibm.com>, devel@openvz.org, xemul@sw.ru, Paul Menage <menage@google.com>, Christoph Lameter <clameter@sgi.com>, Rik van Riel <riel@redhat.com> Subject: Re: [PATCH 2/3][RFC] Containers: Pagecache controller accounting Date: Tue, 06 Mar 2007 13:58:09 +0530 [thread overview] Message-ID: <45ED2619.4000709@linux.vnet.ibm.com> (raw) In-Reply-To: <45ED251C.2010400@linux.vnet.ibm.com> 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;
WARNING: multiple messages have this Message-ID (diff)
From: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> To: Linux Kernel <linux-kernel@vger.kernel.org>, linux-mm@kvack.org Cc: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>, ckrm-tech@lists.sourceforge.net, Balbir Singh <balbir@in.ibm.com>, Srivatsa Vaddagiri <vatsa@in.ibm.com>, devel@openvz.org, xemul@sw.ru, Paul Menage <menage@google.com>, Christoph Lameter <clameter@sgi.com>, Rik van Riel <riel@redhat.com> Subject: Re: [PATCH 2/3][RFC] Containers: Pagecache controller accounting Date: Tue, 06 Mar 2007 13:58:09 +0530 [thread overview] Message-ID: <45ED2619.4000709@linux.vnet.ibm.com> (raw) 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>
next prev parent reply other threads:[~2007-03-06 8:30 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-03-06 8:23 [PATCH 0/3][RFC] Containers: Pagecache accounting and control subsystem (v1) Vaidyanathan Srinivasan 2007-03-06 8:23 ` Vaidyanathan Srinivasan 2007-03-06 8:26 ` [PATCH 1/3][RFC] Containers: Pagecache controller setup Vaidyanathan Srinivasan 2007-03-06 8:26 ` Vaidyanathan Srinivasan 2007-03-06 8:28 ` Vaidyanathan Srinivasan [this message] 2007-03-06 8:28 ` [PATCH 2/3][RFC] Containers: Pagecache controller accounting Vaidyanathan Srinivasan 2007-03-06 8:29 ` [PATCH 3/3][RFC] Containers: Pagecache controller reclaim Vaidyanathan Srinivasan 2007-03-06 8:29 ` Vaidyanathan Srinivasan 2007-03-06 10:24 ` Kari Hurtta 2007-03-06 10:24 ` Kari Hurtta 2007-03-06 11:19 ` Vaidyanathan Srinivasan 2007-03-06 11:19 ` Vaidyanathan Srinivasan 2007-03-27 3:44 ` Aubrey Li 2007-03-27 3:44 ` Aubrey Li 2007-03-27 7:17 ` Vaidyanathan Srinivasan 2007-03-27 7:17 ` Vaidyanathan Srinivasan 2007-03-27 8:41 ` Aubrey Li 2007-03-27 8:41 ` Aubrey Li 2007-03-27 9:44 ` Vaidyanathan Srinivasan 2007-03-27 9:44 ` Vaidyanathan Srinivasan 2007-03-27 10:53 ` Aubrey Li 2007-03-27 10:53 ` Aubrey Li 2007-03-27 12:25 ` Vaidyanathan Srinivasan 2007-03-27 12:25 ` 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
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=45ED2619.4000709@linux.vnet.ibm.com \ --to=svaidy@linux.vnet.ibm.com \ --cc=balbir@in.ibm.com \ --cc=ckrm-tech@lists.sourceforge.net \ --cc=clameter@sgi.com \ --cc=devel@openvz.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=menage@google.com \ --cc=riel@redhat.com \ --cc=vatsa@in.ibm.com \ --cc=xemul@sw.ru \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.