linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH mmotm] memcg: check if first threshold crossed
@ 2010-02-10 23:55 Kirill A. Shutemov
  2010-02-12  0:14 ` KAMEZAWA Hiroyuki
  0 siblings, 1 reply; 2+ messages in thread
From: Kirill A. Shutemov @ 2010-02-10 23:55 UTC (permalink / raw)
  To: linux-mm
  Cc: linux-kernel, Kirill A. Shutemov, Balbir Singh, Pavel Emelyanov,
	KAMEZAWA Hiroyuki

There is a bug in memory thresholds code. We don't check if first
threshold (array index 0) was crossed down. This patch fixes it.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
 mm/memcontrol.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 41e00c2..a443c30 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3252,7 +3252,7 @@ static void __mem_cgroup_threshold(struct mem_cgroup *memcg, bool swap)
 	 * If none of thresholds below usage is crossed, we read
 	 * only one element of the array here.
 	 */
-	for (; i > 0 && unlikely(t->entries[i].threshold > usage); i--)
+	for (; i >= 0 && unlikely(t->entries[i].threshold > usage); i--)
 		eventfd_signal(t->entries[i].eventfd, 1);
 
 	/* i = current_threshold + 1 */
-- 
1.6.5.8

--
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 related	[flat|nested] 2+ messages in thread

* Re: [PATCH mmotm] memcg: check if first threshold crossed
  2010-02-10 23:55 [PATCH mmotm] memcg: check if first threshold crossed Kirill A. Shutemov
@ 2010-02-12  0:14 ` KAMEZAWA Hiroyuki
  0 siblings, 0 replies; 2+ messages in thread
From: KAMEZAWA Hiroyuki @ 2010-02-12  0:14 UTC (permalink / raw)
  To: Kirill A. Shutemov; +Cc: linux-mm, linux-kernel, Balbir Singh, Pavel Emelyanov

On Thu, 11 Feb 2010 01:55:23 +0200
"Kirill A. Shutemov" <kirill@shutemov.name> wrote:

> There is a bug in memory thresholds code. We don't check if first
> threshold (array index 0) was crossed down. This patch fixes it.
> 
> Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
> Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
> Cc: Pavel Emelyanov <xemul@openvz.org>
> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

> ---
>  mm/memcontrol.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 41e00c2..a443c30 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -3252,7 +3252,7 @@ static void __mem_cgroup_threshold(struct mem_cgroup *memcg, bool swap)
>  	 * If none of thresholds below usage is crossed, we read
>  	 * only one element of the array here.
>  	 */
> -	for (; i > 0 && unlikely(t->entries[i].threshold > usage); i--)
> +	for (; i >= 0 && unlikely(t->entries[i].threshold > usage); i--)
>  		eventfd_signal(t->entries[i].eventfd, 1);
>  
>  	/* i = current_threshold + 1 */
> -- 
> 1.6.5.8
> 
> --
> 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>
> 

--
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] 2+ messages in thread

end of thread, other threads:[~2010-02-12  0:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-10 23:55 [PATCH mmotm] memcg: check if first threshold crossed Kirill A. Shutemov
2010-02-12  0:14 ` KAMEZAWA Hiroyuki

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).