All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Emelyanov <xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
To: KAMEZAWA Hiroyuki
	<kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
Cc: "containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org"
	<containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>,
	"yamamoto-jCdQPDEk3idL9jVzuh4AOg@public.gmane.org"
	<yamamoto-jCdQPDEk3idL9jVzuh4AOg@public.gmane.org>,
	menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	"balbir-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org"
	<balbir-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Subject: Re: [RFC][ only for review ] memory controller bacground reclaim [2/5] set/get ops for res_counter
Date: Wed, 28 Nov 2007 14:09:26 +0300	[thread overview]
Message-ID: <474D4C66.2080303@openvz.org> (raw)
In-Reply-To: <20071128175239.e20ec09d.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>

KAMEZAWA Hiroyuki wrote:
> At implmenting high/low watermark in res_counter, it will be better to
> adjust high/low value when limit changes. (or don't allow user to specify
> high/low value)
> 
> This patch adds *internal* interface to modify resource value.
> (If there are only limit/usage/failcnt, these routines are not necessary but..)
> And will be used later.
> 
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
> 
>  include/linux/res_counter.h |    7 +++++++
>  kernel/res_counter.c        |   19 +++++++++++++++++++
>  2 files changed, 26 insertions(+)
> 
> Index: linux-2.6.24-rc3-mm1/include/linux/res_counter.h
> ===================================================================
> --- linux-2.6.24-rc3-mm1.orig/include/linux/res_counter.h	2007-11-28 14:18:21.000000000 +0900
> +++ linux-2.6.24-rc3-mm1/include/linux/res_counter.h	2007-11-28 14:18:33.000000000 +0900
> @@ -59,6 +59,13 @@
>  		int (*write_strategy)(char *buf, unsigned long long *val));
>  
>  /*
> + * A routine for set/get limitation value from kernel internal code.
> + * res->lock should be held before call this.
> + */
> +unsigned long long res_counter_get(struct res_counter *counter, int member);
> +void res_counter_set(struct res_counter *conter, int member,
> +			unsigned long long val);
> +/*
>   * the field descriptors. one for each member of res_counter
>   */
>  
> Index: linux-2.6.24-rc3-mm1/kernel/res_counter.c
> ===================================================================
> --- linux-2.6.24-rc3-mm1.orig/kernel/res_counter.c	2007-11-28 14:18:21.000000000 +0900
> +++ linux-2.6.24-rc3-mm1/kernel/res_counter.c	2007-11-28 14:18:33.000000000 +0900
> @@ -75,6 +75,25 @@
>  	return NULL;
>  }
>  
> +unsigned long long res_counter_get(struct res_counter *res, int member)
> +{
> +	unsigned long long *val;
> +
> +	val = res_counter_member(res, member);
> +
> +	return *val;
> +}
> +
> +void res_counter_set(struct res_counter *res, int member,
> +			unsigned long long newval)
> +{
> +	unsigned long long *val;
> +
> +	val = res_counter_member(res, member);
> +	*val = newval;

You put locking here in the res_counter_write() (patch #1). Why
is it missed here?

> +	return;
> +}
> +
>  ssize_t res_counter_read(struct res_counter *counter, int member,
>  		const char __user *userbuf, size_t nbytes, loff_t *pos,
>  		int (*read_strategy)(unsigned long long val, char *st_buf))
> 
> 

  parent reply	other threads:[~2007-11-28 11:09 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-28  8:49 [RFC][ only for review ] memory controller bacground reclaim [0/5] KAMEZAWA Hiroyuki
     [not found] ` <20071128174923.1f54f53f.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2007-11-28  8:51   ` [RFC][ only for review ] memory controller bacground reclaim [1/5] spinlock fix in res_counter modification KAMEZAWA Hiroyuki
     [not found]     ` <20071128175135.c42adecc.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2007-11-28 11:08       ` Pavel Emelyanov
     [not found]         ` <474D4C2F.8020701-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-11-29  1:14           ` KAMEZAWA Hiroyuki
2007-11-28  8:52   ` [RFC][ only for review ] memory controller bacground reclaim [2/5] set/get ops for res_counter KAMEZAWA Hiroyuki
     [not found]     ` <20071128175239.e20ec09d.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2007-11-28 11:09       ` Pavel Emelyanov [this message]
     [not found]         ` <474D4C66.2080303-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-11-29  1:16           ` KAMEZAWA Hiroyuki
2007-11-28  8:54   ` [RFC][ only for review ] memory controller bacground reclaim [3/5] high/low watermark support in res_counter KAMEZAWA Hiroyuki
     [not found]     ` <20071128175408.1ee479f3.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2007-11-28 11:12       ` Pavel Emelyanov
     [not found]         ` <474D4D35.9060603-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-11-29  1:18           ` KAMEZAWA Hiroyuki
2007-11-29  2:56       ` YAMAMOTO Takashi
     [not found]         ` <20071129025609.0B7111CFE7C-Pcsii4f/SVk@public.gmane.org>
2007-11-29  3:24           ` KAMEZAWA Hiroyuki
     [not found]             ` <20071129122402.101c5fbc.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2007-11-29  3:36               ` YAMAMOTO Takashi
2007-11-28  8:56   ` [RFC][ only for review ] memory controller bacground reclaim [4/5] high/low watermark for memory controller KAMEZAWA Hiroyuki
     [not found]     ` <20071128175607.37df2187.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2007-11-28 11:20       ` Pavel Emelyanov
     [not found]         ` <474D4F01.4070705-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-11-29  1:27           ` KAMEZAWA Hiroyuki
2007-11-28 12:20       ` Pavel Emelyanov
     [not found]         ` <474D5D1A.4070409-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-11-29  1:20           ` KAMEZAWA Hiroyuki
     [not found]             ` <20071129102044.8087386c.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2007-11-29 19:55               ` Oren Laadan
     [not found]                 ` <474F194C.1000401-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2007-11-30  0:26                   ` KAMEZAWA Hiroyuki
2007-12-01  7:09       ` Paul Menage
     [not found]         ` <6599ad830711302309p3a68828fjec6793bc9d854a1-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-12-01 10:45           ` Balbir Singh
     [not found]             ` <47513B50.8090003-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2007-12-01 16:55               ` Paul Menage
     [not found]                 ` <6599ad830712010855j7967ddeau1a558474de4eea19-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-12-01 17:16                   ` Balbir Singh
2007-11-28  8:57   ` [RFC][ only for review ] memory controller bacground reclaim [5/5] KAMEZAWA Hiroyuki
     [not found]     ` <20071128175713.4e9b8fff.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2007-11-28 11:06       ` Pavel Emelyanov
     [not found]         ` <474D4BAE.7090407-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-11-29  1:26           ` KAMEZAWA Hiroyuki
2007-12-01  7:16       ` Paul Menage
2007-11-29 11:53   ` [RFC][ only for review ] memory controller bacground reclaim [0/5] (Does anyone have an idea about throttling ?) KAMEZAWA Hiroyuki
     [not found]     ` <20071129205324.f9e7ab4e.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2007-11-29 14:42       ` Balbir Singh
     [not found]         ` <474ECFEB.9090202-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2007-11-30  0:29           ` KAMEZAWA Hiroyuki

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=474D4C66.2080303@openvz.org \
    --to=xemul-gefaqzzx7r8dnm+yrofe0a@public.gmane.org \
    --cc=balbir-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org \
    --cc=menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=yamamoto-jCdQPDEk3idL9jVzuh4AOg@public.gmane.org \
    /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 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.