From: Balbir Singh <balbir@linux.vnet.ibm.com>
To: Paul Menage <menage@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Linux Containers <containers@lists.osdl.org>,
YAMAMOTO Takashi <yamamoto@valinux.co.jp>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Eric W Biederman <ebiederm@xmission.com>,
Linux MM Mailing List <linux-mm@kvack.org>,
Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>,
Pavel Emelianov <xemul@openvz.org>,
Dave Hansen <haveblue@us.ibm.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC][-mm PATCH 1/8] Memory controller resource counters (v3)
Date: Sat, 21 Jul 2007 22:30:57 +0530 [thread overview]
Message-ID: <46A23BC9.2050003@linux.vnet.ibm.com> (raw)
In-Reply-To: <6599ad830707201320q25c0ded9v937a365a53d9a77@mail.gmail.com>
Paul Menage wrote:
> On 7/20/07, Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
>> +
>> +ssize_t res_counter_read(struct res_counter *counter, int member,
>> + const char __user *userbuf, size_t nbytes, loff_t *pos)
>> +{
>> + unsigned long *val;
>> + char buf[64], *s;
>> +
>> + s = buf;
>> + val = res_counter_member(counter, member);
>> + s += sprintf(s, "%lu\n", *val);
>> + return simple_read_from_buffer((void __user *)userbuf, nbytes,
>> + pos, buf, s - buf);
>> +}
>
> I think it should be possible to use the support built-in to task
> containers to export a uint64 rather than having to create a separate
> function here.
>
That sounds like an easy thing to do, but that means we need to standardize
on the uint64 data type for all platforms.
>> +
>> +ssize_t res_counter_write(struct res_counter *counter, int member,
>> + const char __user *userbuf, size_t nbytes, loff_t *pos)
>> +{
>> + int ret;
>> + char *buf, *end;
>> + unsigned long tmp, *val;
>> +
>> + buf = kmalloc(nbytes + 1, GFP_KERNEL);
>> + ret = -ENOMEM;
>> + if (buf == NULL)
>> + goto out;
>> +
>> + buf[nbytes] = '\0';
>> + ret = -EFAULT;
>> + if (copy_from_user(buf, userbuf, nbytes))
>> + goto out_free;
>> +
>> + ret = -EINVAL;
>> + tmp = simple_strtoul(buf, &end, 10);
>> + if (*end != '\0')
>> + goto out_free;
>> +
>> + val = res_counter_member(counter, member);
>> + *val = tmp;
>> + ret = nbytes;
>> +out_free:
>> + kfree(buf);
>> +out:
>> + return ret;
>> +}
>
> I should probably add a generic "write uint64" wraper to task
> containers as well.
>
Sounds good, that will be really helpful.
> Paul
>
> --
> 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>
--
Warm Regards,
Balbir Singh
Linux Technology Center
IBM, ISTL
WARNING: multiple messages have this Message-ID (diff)
From: Balbir Singh <balbir@linux.vnet.ibm.com>
To: Paul Menage <menage@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Linux Containers <containers@lists.osdl.org>,
YAMAMOTO Takashi <yamamoto@valinux.co.jp>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Eric W Biederman <ebiederm@xmission.com>,
Linux MM Mailing List <linux-mm@kvack.org>,
Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>,
Pavel Emelianov <xemul@openvz.org>,
Dave Hansen <haveblue@us.ibm.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC][-mm PATCH 1/8] Memory controller resource counters (v3)
Date: Sat, 21 Jul 2007 22:30:57 +0530 [thread overview]
Message-ID: <46A23BC9.2050003@linux.vnet.ibm.com> (raw)
In-Reply-To: <6599ad830707201320q25c0ded9v937a365a53d9a77@mail.gmail.com>
Paul Menage wrote:
> On 7/20/07, Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
>> +
>> +ssize_t res_counter_read(struct res_counter *counter, int member,
>> + const char __user *userbuf, size_t nbytes, loff_t *pos)
>> +{
>> + unsigned long *val;
>> + char buf[64], *s;
>> +
>> + s = buf;
>> + val = res_counter_member(counter, member);
>> + s += sprintf(s, "%lu\n", *val);
>> + return simple_read_from_buffer((void __user *)userbuf, nbytes,
>> + pos, buf, s - buf);
>> +}
>
> I think it should be possible to use the support built-in to task
> containers to export a uint64 rather than having to create a separate
> function here.
>
That sounds like an easy thing to do, but that means we need to standardize
on the uint64 data type for all platforms.
>> +
>> +ssize_t res_counter_write(struct res_counter *counter, int member,
>> + const char __user *userbuf, size_t nbytes, loff_t *pos)
>> +{
>> + int ret;
>> + char *buf, *end;
>> + unsigned long tmp, *val;
>> +
>> + buf = kmalloc(nbytes + 1, GFP_KERNEL);
>> + ret = -ENOMEM;
>> + if (buf == NULL)
>> + goto out;
>> +
>> + buf[nbytes] = '\0';
>> + ret = -EFAULT;
>> + if (copy_from_user(buf, userbuf, nbytes))
>> + goto out_free;
>> +
>> + ret = -EINVAL;
>> + tmp = simple_strtoul(buf, &end, 10);
>> + if (*end != '\0')
>> + goto out_free;
>> +
>> + val = res_counter_member(counter, member);
>> + *val = tmp;
>> + ret = nbytes;
>> +out_free:
>> + kfree(buf);
>> +out:
>> + return ret;
>> +}
>
> I should probably add a generic "write uint64" wraper to task
> containers as well.
>
Sounds good, that will be really helpful.
> Paul
>
> --
> 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>
--
Warm Regards,
Balbir Singh
Linux Technology Center
IBM, ISTL
--
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-07-21 17:00 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-20 8:23 [RFC][-mm PATCH 0/8] Memory controller introduction (v3) Balbir Singh
2007-07-20 8:23 ` Balbir Singh
2007-07-20 8:24 ` [RFC][-mm PATCH 1/8] Memory controller resource counters (v3) Balbir Singh
2007-07-20 8:24 ` Balbir Singh
2007-07-20 8:24 ` Balbir Singh
2007-07-20 20:20 ` Paul Menage
2007-07-20 20:20 ` Paul Menage
2007-07-21 17:00 ` Balbir Singh [this message]
2007-07-21 17:00 ` Balbir Singh
2007-07-20 8:24 ` [RFC][-mm PATCH 2/8] Memory controller containers setup (v3) Balbir Singh
2007-07-20 8:24 ` Balbir Singh
2007-07-20 8:24 ` Balbir Singh
2007-07-20 20:30 ` Paul Menage
2007-07-20 20:30 ` Paul Menage
2007-07-20 20:30 ` Paul Menage
2007-07-21 17:04 ` Balbir Singh
2007-07-21 17:04 ` Balbir Singh
2007-07-20 8:24 ` [RFC][-mm PATCH 3/8] Memory controller accounting " Balbir Singh
2007-07-20 8:24 ` Balbir Singh
2007-07-20 8:24 ` Balbir Singh
2007-07-20 20:33 ` Paul Menage
2007-07-20 20:33 ` Paul Menage
2007-07-20 20:33 ` Paul Menage
2007-07-20 20:39 ` Paul Menage
2007-07-20 20:39 ` Paul Menage
2007-07-20 8:24 ` [RFC][-mm PATCH 4/8] Memory controller memory accounting (v3) Balbir Singh
2007-07-20 8:24 ` Balbir Singh
2007-07-20 8:24 ` Balbir Singh
2007-07-20 21:03 ` Paul Menage
2007-07-20 21:03 ` Paul Menage
2007-07-20 21:03 ` Paul Menage
[not found] ` <6599ad830707201403n6a364514y601996145fa3714c-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-07-20 21:09 ` Paul Menage
2007-07-20 21:09 ` Paul Menage
2007-07-20 21:09 ` Paul Menage
2007-07-21 17:11 ` Balbir Singh
2007-07-21 17:11 ` Balbir Singh
2007-07-20 8:24 ` [RFC][-mm PATCH 5/8] Memory controller task migration (v3) Balbir Singh
2007-07-20 8:24 ` Balbir Singh
2007-07-20 8:24 ` Balbir Singh
2007-07-20 8:25 ` [RFC][-mm PATCH 6/8] Memory controller add per container LRU and reclaim (v3) Balbir Singh
2007-07-20 8:25 ` Balbir Singh
2007-07-20 8:25 ` Balbir Singh
2007-07-24 11:51 ` YAMAMOTO Takashi
2007-07-24 11:51 ` YAMAMOTO Takashi
2007-07-24 12:14 ` Balbir Singh
2007-07-24 12:14 ` Balbir Singh
2007-07-20 8:25 ` [RFC][-mm PATCH 7/8] Memory controller OOM handling (v3) Balbir Singh
2007-07-20 8:25 ` Balbir Singh
2007-07-20 8:25 ` Balbir Singh
2007-07-20 8:25 ` [RFC][-mm PATCH 8/8] Add switch to control what type of pages to limit (v3) Balbir Singh
2007-07-20 8:25 ` Balbir Singh
2007-07-20 8:25 ` Balbir Singh
2007-07-20 21:41 ` Paul Menage
2007-07-20 21:41 ` Paul Menage
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=46A23BC9.2050003@linux.vnet.ibm.com \
--to=balbir@linux.vnet.ibm.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=containers@lists.osdl.org \
--cc=ebiederm@xmission.com \
--cc=haveblue@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=menage@google.com \
--cc=svaidy@linux.vnet.ibm.com \
--cc=xemul@openvz.org \
--cc=yamamoto@valinux.co.jp \
/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.