From: Pavel Emelianov <xemul@sw.ru>
To: balbir@in.ibm.com
Cc: Andrew Morton <akpm@osdl.org>, Paul Menage <menage@google.com>,
Srivatsa Vaddagiri <vatsa@in.ibm.com>,
devel@openvz.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
containers@lists.osdl.org, Kirill Korotaev <dev@sw.ru>
Subject: Re: [RFC][PATCH 5/7] Per-container OOM killer and page reclamation
Date: Sun, 11 Mar 2007 11:41:41 +0300 [thread overview]
Message-ID: <45F3C0C5.9000900@sw.ru> (raw)
In-Reply-To: <45F1CFC7.3070406@in.ibm.com>
Balbir Singh wrote:
> Hi, Pavel,
>
> Please find my patch to add LRU behaviour to your latest RSS controller.
Thanks for participation and additional testing :)
I'll include this into next generation of patches.
> Balbir Singh
> Linux Technology Center
> IBM, ISTL
>
>
> ------------------------------------------------------------------------
>
> Add LRU behaviour to the RSS controller patches posted by Pavel Emelianov
>
> http://lkml.org/lkml/2007/3/6/198
>
> which was in turn similar to the RSS controller posted by me
>
> http://lkml.org/lkml/2007/2/26/8
>
> Pavel's patches have a per container list of pages, which helps reduce
> reclaim time of the RSS controller but the per container list of pages is
> in FIFO order. I've implemented active and inactive lists per container to
> help select the right set of pages to reclaim when the container is under
> memory pressure.
>
> I've tested these patches on a ppc64 machine and they work fine for
> the minimal testing I've done.
>
> Pavel would you please include these patches in your next iteration.
>
> Comments, suggestions and further improvements are as always welcome!
>
> Signed-off-by: <balbir@in.ibm.com>
> ---
>
> include/linux/rss_container.h | 1
> mm/rss_container.c | 47 +++++++++++++++++++++++++++++++-----------
> mm/swap.c | 5 ++++
> mm/vmscan.c | 3 ++
> 4 files changed, 44 insertions(+), 12 deletions(-)
>
> diff -puN include/linux/rss_container.h~rss-container-lru2 include/linux/rss_container.h
> --- linux-2.6.20/include/linux/rss_container.h~rss-container-lru2 2007-03-09 22:52:56.000000000 +0530
> +++ linux-2.6.20-balbir/include/linux/rss_container.h 2007-03-10 00:39:59.000000000 +0530
> @@ -19,6 +19,7 @@ int container_rss_prepare(struct page *,
> void container_rss_add(struct page_container *);
> void container_rss_del(struct page_container *);
> void container_rss_release(struct page_container *);
> +void container_rss_move_lists(struct page *pg, bool active);
>
> int mm_init_container(struct mm_struct *mm, struct task_struct *tsk);
> void mm_free_container(struct mm_struct *mm);
> diff -puN mm/rss_container.c~rss-container-lru2 mm/rss_container.c
> --- linux-2.6.20/mm/rss_container.c~rss-container-lru2 2007-03-09 22:52:56.000000000 +0530
> +++ linux-2.6.20-balbir/mm/rss_container.c 2007-03-10 02:42:54.000000000 +0530
> @@ -17,7 +17,8 @@ static struct container_subsys rss_subsy
>
> struct rss_container {
> struct res_counter res;
> - struct list_head page_list;
> + struct list_head inactive_list;
> + struct list_head active_list;
> struct container_subsys_state css;
> };
>
> @@ -96,6 +97,26 @@ void container_rss_release(struct page_c
> kfree(pc);
> }
>
> +void container_rss_move_lists(struct page *pg, bool active)
> +{
> + struct rss_container *rss;
> + struct page_container *pc;
> +
> + if (!page_mapped(pg))
> + return;
> +
> + pc = page_container(pg);
> + BUG_ON(!pc);
> + rss = pc->cnt;
> +
> + spin_lock_irq(&rss->res.lock);
> + if (active)
> + list_move(&pc->list, &rss->active_list);
> + else
> + list_move(&pc->list, &rss->inactive_list);
> + spin_unlock_irq(&rss->res.lock);
> +}
> +
> void container_rss_add(struct page_container *pc)
> {
> struct page *pg;
> @@ -105,7 +126,7 @@ void container_rss_add(struct page_conta
> rss = pc->cnt;
>
> spin_lock(&rss->res.lock);
> - list_add(&pc->list, &rss->page_list);
> + list_add(&pc->list, &rss->active_list);
> spin_unlock(&rss->res.lock);
>
> page_container(pg) = pc;
> @@ -141,7 +162,10 @@ unsigned long container_isolate_pages(un
> struct zone *z;
>
> spin_lock_irq(&rss->res.lock);
> - src = &rss->page_list;
> + if (active)
> + src = &rss->active_list;
> + else
> + src = &rss->inactive_list;
>
> for (scan = 0; scan < nr_to_scan && !list_empty(src); scan++) {
> pc = list_entry(src->prev, struct page_container, list);
> @@ -152,13 +176,10 @@ unsigned long container_isolate_pages(un
>
> spin_lock(&z->lru_lock);
> if (PageLRU(page)) {
> - if ((active && PageActive(page)) ||
> - (!active && !PageActive(page))) {
> - if (likely(get_page_unless_zero(page))) {
> - ClearPageLRU(page);
> - nr_taken++;
> - list_move(&page->lru, dst);
> - }
> + if (likely(get_page_unless_zero(page))) {
> + ClearPageLRU(page);
> + nr_taken++;
> + list_move(&page->lru, dst);
> }
> }
> spin_unlock(&z->lru_lock);
> @@ -212,7 +233,8 @@ static int rss_create(struct container_s
> return -ENOMEM;
>
> res_counter_init(&rss->res);
> - INIT_LIST_HEAD(&rss->page_list);
> + INIT_LIST_HEAD(&rss->inactive_list);
> + INIT_LIST_HEAD(&rss->active_list);
> cont->subsys[rss_subsys.subsys_id] = &rss->css;
> return 0;
> }
> @@ -284,7 +306,8 @@ static __init int rss_create_early(struc
>
> rss = &init_rss_container;
> res_counter_init(&rss->res);
> - INIT_LIST_HEAD(&rss->page_list);
> + INIT_LIST_HEAD(&rss->inactive_list);
> + INIT_LIST_HEAD(&rss->active_list);
> cont->subsys[rss_subsys.subsys_id] = &rss->css;
> ss->create = rss_create;
> return 0;
> diff -puN mm/vmscan.c~rss-container-lru2 mm/vmscan.c
> --- linux-2.6.20/mm/vmscan.c~rss-container-lru2 2007-03-09 22:52:56.000000000 +0530
> +++ linux-2.6.20-balbir/mm/vmscan.c 2007-03-10 00:42:35.000000000 +0530
> @@ -1142,6 +1142,7 @@ static unsigned long container_shrink_pa
> else
> add_page_to_inactive_list(z, page);
> spin_unlock_irq(&z->lru_lock);
> + container_rss_move_lists(page, false);
>
> put_page(page);
> }
> @@ -1191,6 +1192,7 @@ static void container_shrink_pages_activ
> list_move(&page->lru, &z->inactive_list);
> z->nr_inactive++;
> spin_unlock_irq(&z->lru_lock);
> + container_rss_move_lists(page, false);
>
> put_page(page);
> }
> @@ -1206,6 +1208,7 @@ static void container_shrink_pages_activ
> list_move(&page->lru, &z->active_list);
> z->nr_active++;
> spin_unlock_irq(&z->lru_lock);
> + container_rss_move_lists(page, true);
>
> put_page(page);
> }
> diff -puN mm/swap.c~rss-container-lru2 mm/swap.c
> --- linux-2.6.20/mm/swap.c~rss-container-lru2 2007-03-10 00:42:38.000000000 +0530
> +++ linux-2.6.20-balbir/mm/swap.c 2007-03-10 01:20:39.000000000 +0530
> @@ -30,6 +30,7 @@
> #include <linux/cpu.h>
> #include <linux/notifier.h>
> #include <linux/init.h>
> +#include <linux/rss_container.h>
>
> /* How many pages do we try to swap or page in/out together? */
> int page_cluster;
> @@ -140,6 +141,7 @@ int rotate_reclaimable_page(struct page
> void fastcall activate_page(struct page *page)
> {
> struct zone *zone = page_zone(page);
> + bool moved = false;
>
> spin_lock_irq(&zone->lru_lock);
> if (PageLRU(page) && !PageActive(page)) {
> @@ -147,8 +149,11 @@ void fastcall activate_page(struct page
> SetPageActive(page);
> add_page_to_active_list(zone, page);
> __count_vm_event(PGACTIVATE);
> + moved = true;
> }
> spin_unlock_irq(&zone->lru_lock);
> + if (moved)
> + container_rss_move_lists(page, true);
> }
>
> /*
> _
next prev parent reply other threads:[~2007-03-11 8:38 UTC|newest]
Thread overview: 129+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-06 14:42 [RFC][PATCH 0/7] Resource controllers based on process containers Pavel Emelianov
2007-03-06 14:49 ` [RFC][PATCH 1/7] Resource counters Pavel Emelianov
2007-03-07 4:03 ` Balbir Singh
2007-03-07 7:19 ` Pavel Emelianov
2007-03-09 16:37 ` Herbert Poetzl
2007-03-11 9:01 ` Pavel Emelianov
2007-03-11 19:00 ` Eric W. Biederman
2007-03-12 1:16 ` Herbert Poetzl
2007-03-13 9:09 ` Eric W. Biederman
2007-03-13 9:27 ` Pavel Emelianov
2007-03-13 9:49 ` [Devel] " Kirill Korotaev
2007-03-13 15:21 ` Herbert Poetzl
2007-03-13 15:41 ` Pavel Emelianov
2007-03-13 16:07 ` Srivatsa Vaddagiri
2007-03-14 7:12 ` Pavel Emelianov
2007-03-15 16:51 ` Eric W. Biederman
2007-03-13 16:32 ` Herbert Poetzl
2007-03-06 14:55 ` [RFC][PATCH 2/7] RSS controller core Pavel Emelianov
2007-03-06 22:00 ` Andrew Morton
2007-03-09 16:48 ` Herbert Poetzl
2007-03-11 9:08 ` Pavel Emelianov
2007-03-11 14:32 ` Herbert Poetzl
2007-03-11 15:04 ` Pavel Emelianov
2007-03-12 0:41 ` Herbert Poetzl
2007-03-12 8:31 ` Pavel Emelianov
2007-03-12 9:55 ` Balbir Singh
2007-03-12 23:43 ` Herbert Poetzl
2007-03-13 1:57 ` Balbir Singh
2007-03-13 2:24 ` Srivatsa Vaddagiri
2007-03-13 16:06 ` Herbert Poetzl
2007-03-11 12:26 ` Kirill Korotaev
2007-03-11 12:51 ` Andrew Morton
2007-03-11 15:51 ` Balbir Singh
2007-03-11 19:34 ` Eric W. Biederman
2007-03-12 9:23 ` [Devel] " Kirill Korotaev
2007-03-13 9:26 ` Eric W. Biederman
2007-03-13 15:43 ` Kirill Korotaev
2007-03-12 1:00 ` Herbert Poetzl
2007-03-12 9:02 ` Pavel Emelianov
2007-03-12 21:11 ` Herbert Poetzl
2007-03-13 7:17 ` Pavel Emelianov
2007-03-13 15:05 ` Herbert Poetzl
2007-03-13 15:32 ` Pavel Emelianov
2007-03-13 15:10 ` Kirill Korotaev
2007-03-13 15:11 ` Herbert Poetzl
2007-03-13 15:54 ` Kirill Korotaev
2007-03-12 18:42 ` Dave Hansen
2007-03-12 22:41 ` Herbert Poetzl
2007-03-12 23:02 ` Dave Hansen
2007-03-18 16:58 ` Eric W. Biederman
2007-03-13 6:04 ` Andrew Morton
2007-03-13 10:19 ` [Devel] " Kirill Korotaev
2007-03-13 11:48 ` Andrew Morton
2007-03-13 14:59 ` Herbert Poetzl
2007-03-13 17:05 ` Dave Hansen
2007-03-14 15:38 ` Mel Gorman
2007-03-14 20:42 ` Dave Hansen
2007-03-20 18:57 ` Mel Gorman
2007-03-18 22:44 ` [Devel] " Paul Menage
2007-03-19 17:41 ` Eric W. Biederman
2007-03-13 17:26 ` Dave Hansen
2007-03-13 19:09 ` Alan Cox
2007-03-13 20:28 ` Dave Hansen
2007-03-16 0:55 ` Eric W. Biederman
2007-03-16 16:31 ` Dave Hansen
2007-03-16 18:54 ` Eric W. Biederman
2007-03-16 19:46 ` Dave Hansen
2007-03-18 17:42 ` Eric W. Biederman
2007-03-19 15:48 ` Herbert Poetzl
2007-03-20 16:15 ` controlling mmap()'d vs read/write() pages Dave Hansen
2007-03-20 21:19 ` Eric W. Biederman
2007-03-23 0:51 ` Herbert Poetzl
2007-03-23 5:57 ` Nick Piggin
2007-03-23 10:12 ` Eric W. Biederman
2007-03-23 10:47 ` Nick Piggin
2007-03-23 12:21 ` Eric W. Biederman
2007-03-28 7:33 ` Nick Piggin
2007-03-23 16:41 ` Dave Hansen
2007-03-23 18:16 ` Herbert Poetzl
2007-03-28 9:18 ` Balbir Singh
2007-03-14 16:47 ` [RFC][PATCH 2/7] RSS controller core Mel Gorman
2007-03-07 5:37 ` Balbir Singh
2007-03-07 7:27 ` Pavel Emelianov
2007-03-06 14:58 ` [RFC][PATCH 3/7] Data structures changes for RSS accounting Pavel Emelianov
2007-03-11 19:13 ` Eric W. Biederman
2007-03-12 16:16 ` Kirill Korotaev
2007-03-12 16:48 ` Dave Hansen
2007-03-12 17:19 ` Pavel Emelianov
2007-03-12 17:27 ` Dave Hansen
2007-03-13 7:10 ` Pavel Emelianov
2007-03-12 17:21 ` Balbir Singh
2007-03-06 15:00 ` [RFC][PATCH 4/7] RSS accounting hooks over the code Pavel Emelianov
2007-03-11 19:14 ` Eric W. Biederman
2007-03-12 16:23 ` Kirill Korotaev
2007-03-12 16:50 ` Dave Hansen
2007-03-12 17:07 ` Kirill Korotaev
2007-03-12 17:33 ` Dave Hansen
2007-03-13 9:43 ` Eric W. Biederman
2007-03-12 23:54 ` Herbert Poetzl
2007-03-13 9:58 ` Eric W. Biederman
2007-03-13 10:25 ` Nick Piggin
2007-03-13 16:01 ` Eric W. Biederman
2007-03-14 3:51 ` Nick Piggin
2007-03-14 6:42 ` Balbir Singh
2007-03-14 6:57 ` Nick Piggin
2007-03-14 7:48 ` Balbir Singh
2007-03-14 13:25 ` Vaidyanathan Srinivasan
2007-03-14 13:49 ` Nick Piggin
2007-03-14 14:43 ` Vaidyanathan Srinivasan
2007-03-14 16:16 ` Kirill Korotaev
2007-03-15 5:01 ` Nick Piggin
2007-03-15 5:44 ` Balbir Singh
2007-03-28 20:15 ` Ethan Solomita
2007-03-14 15:37 ` Cedric Le Goater
2007-03-14 15:45 ` Pavel Emelianov
2007-03-06 15:03 ` [RFC][PATCH 5/7] Per-container OOM killer and page reclamation Pavel Emelianov
2007-03-09 21:21 ` Balbir Singh
2007-03-11 8:41 ` Pavel Emelianov [this message]
2007-03-06 15:04 ` [RFC][PATCH 6/7] Account for the number of tasks within container Pavel Emelianov
2007-03-07 2:00 ` Paul Menage
2007-03-07 7:13 ` Pavel Emelianov
2007-03-08 13:49 ` Paul Menage
2007-03-11 8:36 ` Pavel Emelianov
2007-03-06 15:07 ` [RFC][PATCH 7/7] Account for the number of files opened " Pavel Emelianov
2007-03-07 2:02 ` [RFC][PATCH 0/7] Resource controllers based on process containers Paul Menage
2007-03-07 7:30 ` Pavel Emelianov
2007-03-07 6:52 ` Balbir Singh
2007-03-07 7:32 ` Pavel Emelianov
2007-03-07 9:43 ` Kirill Korotaev
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=45F3C0C5.9000900@sw.ru \
--to=xemul@sw.ru \
--cc=akpm@osdl.org \
--cc=balbir@in.ibm.com \
--cc=containers@lists.osdl.org \
--cc=dev@sw.ru \
--cc=devel@openvz.org \
--cc=linux-kernel@vger.kernel.org \
--cc=menage@google.com \
--cc=vatsa@in.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;
as well as URLs for NNTP newsgroup(s).