From: Nikolay Borisov <kernel@kyup.com>
To: David Rientjes <rientjes@google.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Hocko <mhocko@suse.com>,
Johannes Weiner <hannes@cmpxchg.org>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [patch] mm, hugetlb_cgroup: round limit_in_bytes down to hugepage size
Date: Wed, 6 Apr 2016 10:26:47 +0300 [thread overview]
Message-ID: <5704BA37.2080508@kyup.com> (raw)
In-Reply-To: <alpine.DEB.2.10.1604051824320.32718@chino.kir.corp.google.com>
On 04/06/2016 04:25 AM, David Rientjes wrote:
> The page_counter rounds limits down to page size values. This makes
> sense, except in the case of hugetlb_cgroup where it's not possible to
> charge partial hugepages.
>
> Round the hugetlb_cgroup limit down to hugepage size.
>
> Signed-off-by: David Rientjes <rientjes@google.com>
> ---
> mm/hugetlb_cgroup.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c
> --- a/mm/hugetlb_cgroup.c
> +++ b/mm/hugetlb_cgroup.c
> @@ -288,6 +288,7 @@ static ssize_t hugetlb_cgroup_write(struct kernfs_open_file *of,
>
> switch (MEMFILE_ATTR(of_cft(of)->private)) {
> case RES_LIMIT:
> + nr_pages &= ~((1 << huge_page_order(&hstates[idx])) - 1);
Why not:
nr_pages = round_down(nr_pages, huge_page_order(&hstates[idx]));
> mutex_lock(&hugetlb_limit_mutex);
> ret = page_counter_limit(&h_cg->hugepage[idx], nr_pages);
> mutex_unlock(&hugetlb_limit_mutex);
>
--
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>
WARNING: multiple messages have this Message-ID (diff)
From: Nikolay Borisov <kernel@kyup.com>
To: David Rientjes <rientjes@google.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Hocko <mhocko@suse.com>,
Johannes Weiner <hannes@cmpxchg.org>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [patch] mm, hugetlb_cgroup: round limit_in_bytes down to hugepage size
Date: Wed, 6 Apr 2016 10:26:47 +0300 [thread overview]
Message-ID: <5704BA37.2080508@kyup.com> (raw)
In-Reply-To: <alpine.DEB.2.10.1604051824320.32718@chino.kir.corp.google.com>
On 04/06/2016 04:25 AM, David Rientjes wrote:
> The page_counter rounds limits down to page size values. This makes
> sense, except in the case of hugetlb_cgroup where it's not possible to
> charge partial hugepages.
>
> Round the hugetlb_cgroup limit down to hugepage size.
>
> Signed-off-by: David Rientjes <rientjes@google.com>
> ---
> mm/hugetlb_cgroup.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c
> --- a/mm/hugetlb_cgroup.c
> +++ b/mm/hugetlb_cgroup.c
> @@ -288,6 +288,7 @@ static ssize_t hugetlb_cgroup_write(struct kernfs_open_file *of,
>
> switch (MEMFILE_ATTR(of_cft(of)->private)) {
> case RES_LIMIT:
> + nr_pages &= ~((1 << huge_page_order(&hstates[idx])) - 1);
Why not:
nr_pages = round_down(nr_pages, huge_page_order(&hstates[idx]));
> mutex_lock(&hugetlb_limit_mutex);
> ret = page_counter_limit(&h_cg->hugepage[idx], nr_pages);
> mutex_unlock(&hugetlb_limit_mutex);
>
next prev parent reply other threads:[~2016-04-06 7:26 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-06 1:25 [patch] mm, hugetlb_cgroup: round limit_in_bytes down to hugepage size David Rientjes
2016-04-06 1:25 ` David Rientjes
2016-04-06 7:26 ` Nikolay Borisov [this message]
2016-04-06 7:26 ` Nikolay Borisov
2016-04-06 7:33 ` Nikolay Borisov
2016-04-06 7:33 ` Nikolay Borisov
2016-04-06 9:09 ` Michal Hocko
2016-04-06 9:09 ` Michal Hocko
2016-04-06 22:10 ` [patch v2] " David Rientjes
2016-04-06 22:10 ` David Rientjes
2016-04-07 12:51 ` Michal Hocko
2016-04-07 12:51 ` Michal Hocko
2016-04-14 20:22 ` David Rientjes
2016-04-14 20:22 ` David Rientjes
2016-04-15 13:24 ` Michal Hocko
2016-04-15 13:24 ` Michal Hocko
2016-04-18 21:23 ` David Rientjes
2016-04-18 21:23 ` David Rientjes
2016-04-25 21:52 ` Andrew Morton
2016-04-25 21:52 ` Andrew Morton
2016-04-25 23:54 ` [patch v3] " David Rientjes
2016-04-25 23:54 ` David Rientjes
2016-04-25 21:30 ` [patch v2] " David Rientjes
2016-04-25 21:30 ` David Rientjes
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=5704BA37.2080508@kyup.com \
--to=kernel@kyup.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=rientjes@google.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 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.