login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2008
»
February
»
19
Re: [mm] [PATCH 2/4] Add the soft limit interface v2
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Balbir Singh
Subject:
Re: [mm] [PATCH 2/4] Add the soft limit interface v2
Date: Tuesday, February 19, 2008 - 1:36 am
Li Zefan wrote:
quoted text
> Li Zefan 写道: >> Balbir Singh wrote: >>> A new configuration file called soft_limit_in_bytes is added. The parsing >>> and configuration rules remain the same as for the limit_in_bytes user >>> interface. >>> >>> A global list of all memory cgroups over their soft limit is maintained. >>> This list is then used to reclaim memory on global pressure. A cgroup is >>> removed from the list when the cgroup is deleted. >>> >>> The global list is protected with a read-write spinlock. >>> >> You are not using read-write spinlock.. >> > > Ah, the spinlock is changed to r/w spinlock in [PATCH 3/4]. > >>> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> >>> --- >>> >>> mm/memcontrol.c | 33 ++++++++++++++++++++++++++++++++- >>> 1 file changed, 32 insertions(+), 1 deletion(-) >>> >>> diff -puN mm/memcontrol.c~memory-controller-add-soft-limit-interface mm/memcontrol.c >>> --- linux-2.6.25-rc2/mm/memcontrol.c~memory-controller-add-soft-limit-interface 2008-02-19 12:31:49.000000000 +0530 >>> +++ linux-2.6.25-rc2-balbir/mm/memcontrol.c 2008-02-19 12:31:49.000000000 +0530 >>> @@ -35,6 +35,10 @@ >>> >>> struct cgroup_subsys mem_cgroup_subsys; >>> static const int MEM_CGROUP_RECLAIM_RETRIES = 5; >>> +static spinlock_t mem_cgroup_sl_list_lock; /* spin lock that protects */ >>> + /* the list of cgroups over*/ >>> + /* their soft limit */ >>> +static struct list_head mem_cgroup_sl_exceeded_list; >>> >>> /* >>> * Statistics for memory cgroup. >>> @@ -136,6 +140,10 @@ struct mem_cgroup { >>> * statistics. >>> */ >>> struct mem_cgroup_stat stat; >>> + /* >>> + * List of all mem_cgroup's that exceed their soft limit >>> + */ >>> + struct list_head sl_exceeded_list; >>> }; >>> >>> /* >>> @@ -679,6 +687,18 @@ retry: >>> goto retry; >>> } >>> >>> + /* >>> + * If we exceed our soft limit, we get added to the list of >>> + * cgroups over their soft limit >>> + */ >>> + if (!res_counter_check_under_limit(&mem->res, RES_SOFT_LIMIT)) { >>> + spin_lock_irqsave(&mem_cgroup_sl_list_lock, flags); >>> + if (list_empty(&mem->sl_exceeded_list)) >>> + list_add_tail(&mem->sl_exceeded_list, >>> + &mem_cgroup_sl_exceeded_list); >>> + spin_unlock_irqrestore(&mem_cgroup_sl_list_lock, flags); >>> + } >>> + >>> mz = page_cgroup_zoneinfo(pc); >>> spin_lock_irqsave(&mz->lru_lock, flags); >>> /* Update statistics vector */ >>> @@ -736,13 +756,14 @@ void mem_cgroup_uncharge(struct page_cgr >>> if (atomic_dec_and_test(&pc->ref_cnt)) { >>> page = pc->page; >>> mz = page_cgroup_zoneinfo(pc); >>> + mem = pc->mem_cgroup; >>> /* >>> * get page->cgroup and clear it under lock. >>> * force_empty can drop page->cgroup without checking refcnt. >>> */ >>> unlock_page_cgroup(page); >>> + >>> if (clear_page_cgroup(page, pc) == pc) { >>> - mem = pc->mem_cgroup; >>> css_put(&mem->css); >>> res_counter_uncharge(&mem->res, PAGE_SIZE); >>> spin_lock_irqsave(&mz->lru_lock, flags); >>> @@ -1046,6 +1067,12 @@ static struct cftype mem_cgroup_files[] >>> .name = "stat", >>> .open = mem_control_stat_open, >>> }, >>> + { >>> + .name = "soft_limit_in_bytes", >>> + .private = RES_SOFT_LIMIT, >>> + .write = mem_cgroup_write, >>> + .read = mem_cgroup_read, >>> + }, >>> }; >>> >>> static int alloc_mem_cgroup_per_zone_info(struct mem_cgroup *mem, int node) >>> @@ -1097,6 +1124,9 @@ mem_cgroup_create(struct cgroup_subsys * >>> if (unlikely((cont->parent) == NULL)) { >>> mem = &init_mem_cgroup; >>> init_mm.mem_cgroup = mem; >>> + INIT_LIST_HEAD(&mem->sl_exceeded_list); >>> + spin_lock_init(&mem_cgroup_sl_list_lock); >>> + INIT_LIST_HEAD(&mem_cgroup_sl_exceeded_list); >>> } else >>> mem = kzalloc(sizeof(struct mem_cgroup), GFP_KERNEL); >>> >>> @@ -1104,6 +1134,7 @@ mem_cgroup_create(struct cgroup_subsys * >>> return NULL; >>> >>> res_counter_init(&mem->res); >>> + INIT_LIST_HEAD(&mem->sl_exceeded_list); >>> >> mem->sl_exceeded_list initialized twice ? >>
Good catch, yes for the root, it can be initialized twice. I'll fix it in v3.
quoted text
>>> memset(&mem->info, 0, sizeof(mem->info)); >>> >>> _ >>> >> --
-- Warm Regards, Balbir Singh Linux Technology Center IBM, ISTL --
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[mm][PATCH 0/4] Add soft limits to the memory controller v2
, Balbir Singh
, (Tue Feb 19, 12:02 am)
[mm] [PATCH 1/4] Modify resource counters to add soft limi ...
, Balbir Singh
, (Tue Feb 19, 12:02 am)
[mm] [PATCH 2/4] Add the soft limit interface v2
, Balbir Singh
, (Tue Feb 19, 12:02 am)
[mm] [PATCH 3/4] Reclaim from groups over their soft limit ...
, Balbir Singh
, (Tue Feb 19, 12:03 am)
[mm] [PATCH 4/4] Add soft limit documentation v2
, Balbir Singh
, (Tue Feb 19, 12:03 am)
Re: [mm] [PATCH 2/4] Add the soft limit interface v2
, Li Zefan
, (Tue Feb 19, 12:33 am)
Re: [mm] [PATCH 2/4] Add the soft limit interface v2
, Li Zefan
, (Tue Feb 19, 12:42 am)
Re: [mm] [PATCH 2/4] Add the soft limit interface v2
, Balbir Singh
, (Tue Feb 19, 1:36 am)
Re: [mm] [PATCH 2/4] Add the soft limit interface v2
, Balbir Singh
, (Tue Feb 19, 1:38 am)
Navigation
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Mel Gorman
Re: [PATCH 1/4] vmstat: remove zone->lock from walk_zones_in_node
Guenter Roeck
Re: [lm-sensors] Location for thermal drivers
David Woodhouse
Re: RFC: Moving firmware blobs out of the kernel.
Siddha, Suresh B
Re: [PATCH 2.6.21 review I] [11/25] x86: default to physical mode on hotplug CPU k...
Peter Zijlstra
Re: [patch 4/6] mm: merge populate and nopage into fault (fixes nonlinear)
git-commits-head
:
Linux Kernel Mailing List
[MIPS] Fix potential latency problem due to non-atomic cpu_wait.
Linux Kernel Mailing List
USB: rename USB_SPEED_VARIABLE to USB_SPEED_WIRELESS
Linux Kernel Mailing List
lib/vsprintf.c: fix bug omitting minus sign of numbers (module_param)
Linux Kernel Mailing List
[Bluetooth] Initiate authentication during connection establishment
Linux Kernel Mailing List
[POWERPC] 4xx: Add ppc40x_defconfig
linux-netdev
:
MERCEDES
Your mail id has won 950,000.00 in the MERCEDES Benz Online Promo.for claims send:
David Miller
Re: [PATCH] xen/netfront: do not mark packets of length < MSS as GSO
David Miller
Re: skb_segment() questions
Shan Wei
[RFC PATCH net-next 2/5]IPv6:netfilter: Send an ICMPv6 "Fragment Reassembly Timeou...
Stanislaw Gruszka
[PATCH 1/4] bnx2x: use smp_mb() to keep ordering of read write operations
git
:
Nicolas Sebrecht
git-svn died of signal 11 (was "3 failures on test t9100 (svn)")
Junio C Hamano
Re: [PATCH 2/2] Add url.<base>.pushInsteadOf: URL rewriting for push only
Martin Langhoff
Re: [PATCH] GIT commit statistics.
Alexandre Julliard
[PATCH] gitweb: Put back shortlog instead of graphiclog in the project list.
Josh Triplett
[PATCH 2/2] Add url.<base>.pushInsteadOf: URL rewriting for push only
openbsd-misc
:
Taisto Qvist XX
Re: AMD GEODE LX-800 just works with kernel from install42.iso and kernelpanics wi...
Nico Meijer
Re: gOS Develop Kit with VIA pc-1 Processor Platform VIA C7-D
Andreas Bihlmaier
Re: jetway board sensors (Fintek F71805F)
admin
Drive a 2009 car from R799p/m
Antti Harri
Re: how to create a sha256 hash
Colocation donated by:
Syndicate