All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov@virtuozzo.com>
To: mhocko@kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Johannes Weiner <hannes@cmpxchg.org>, Shaohua Li <shli@fb.com>,
	Ben Hutchings <ben@decadent.org.uk>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>,
	Michal Hocko <mhocko@suse.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] memcg: Fix thresholds for 32b architectures.
Date: Tue, 27 Oct 2015 18:22:03 +0300	[thread overview]
Message-ID: <20151027152203.GG13221@esperanza> (raw)
In-Reply-To: <1445942234-11175-1-git-send-email-mhocko@kernel.org>

On Tue, Oct 27, 2015 at 11:37:14AM +0100, mhocko@kernel.org wrote:
> From: Michal Hocko <mhocko@suse.com>
> 
> 424cdc141380 ("memcg: convert threshold to bytes") has fixed a
> regression introduced by 3e32cb2e0a12 ("mm: memcontrol: lockless page
> counters") where thresholds were silently converted to use page units
> rather than bytes when interpreting the user input.
> 
> The fix is not complete, though, as properly pointed out by Ben
> Hutchings during stable backport review. The page count is converted
> to bytes but unsigned long is used to hold the value which would
> be obviously not sufficient for 32b systems with more than 4G
> thresholds. The same applies to usage as taken from mem_cgroup_usage
> which might overflow.
> 
> Let's remove this bytes vs. pages internal tracking differences and
> handle thresholds in page units internally. Chage mem_cgroup_usage()
> to return the value in page units and revert 424cdc141380 because this
> should be sufficient for the consistent handling.
> mem_cgroup_read_u64 as the only users of mem_cgroup_usage outside of
> the threshold handling code is converted to give the proper in bytes
> result. It is doing that already for page_counter output so this is
> more consistent as well.
> 
> The value presented to the userspace is still in bytes units.
> 
> Fixes: 424cdc141380 ("memcg: convert threshold to bytes")
> Fixes: 3e32cb2e0a12 ("mm: memcontrol: lockless page counters")
> CC: stable@vger.kernel.org
> Reported-by: Ben Hutchings <ben@decadent.org.uk>
> Signed-off-by: Michal Hocko <mhocko@suse.com>

Reviewed-by: Vladimir Davydov <vdavydov@virtuozzo.com>

--
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: Vladimir Davydov <vdavydov@virtuozzo.com>
To: <mhocko@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Johannes Weiner <hannes@cmpxchg.org>, Shaohua Li <shli@fb.com>,
	Ben Hutchings <ben@decadent.org.uk>, <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Michal Hocko <mhocko@suse.com>, <stable@vger.kernel.org>
Subject: Re: [PATCH] memcg: Fix thresholds for 32b architectures.
Date: Tue, 27 Oct 2015 18:22:03 +0300	[thread overview]
Message-ID: <20151027152203.GG13221@esperanza> (raw)
In-Reply-To: <1445942234-11175-1-git-send-email-mhocko@kernel.org>

On Tue, Oct 27, 2015 at 11:37:14AM +0100, mhocko@kernel.org wrote:
> From: Michal Hocko <mhocko@suse.com>
> 
> 424cdc141380 ("memcg: convert threshold to bytes") has fixed a
> regression introduced by 3e32cb2e0a12 ("mm: memcontrol: lockless page
> counters") where thresholds were silently converted to use page units
> rather than bytes when interpreting the user input.
> 
> The fix is not complete, though, as properly pointed out by Ben
> Hutchings during stable backport review. The page count is converted
> to bytes but unsigned long is used to hold the value which would
> be obviously not sufficient for 32b systems with more than 4G
> thresholds. The same applies to usage as taken from mem_cgroup_usage
> which might overflow.
> 
> Let's remove this bytes vs. pages internal tracking differences and
> handle thresholds in page units internally. Chage mem_cgroup_usage()
> to return the value in page units and revert 424cdc141380 because this
> should be sufficient for the consistent handling.
> mem_cgroup_read_u64 as the only users of mem_cgroup_usage outside of
> the threshold handling code is converted to give the proper in bytes
> result. It is doing that already for page_counter output so this is
> more consistent as well.
> 
> The value presented to the userspace is still in bytes units.
> 
> Fixes: 424cdc141380 ("memcg: convert threshold to bytes")
> Fixes: 3e32cb2e0a12 ("mm: memcontrol: lockless page counters")
> CC: stable@vger.kernel.org
> Reported-by: Ben Hutchings <ben@decadent.org.uk>
> Signed-off-by: Michal Hocko <mhocko@suse.com>

Reviewed-by: Vladimir Davydov <vdavydov@virtuozzo.com>

WARNING: multiple messages have this Message-ID (diff)
From: Vladimir Davydov <vdavydov@virtuozzo.com>
To: <mhocko@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Johannes Weiner <hannes@cmpxchg.org>, Shaohua Li <shli@fb.com>,
	Ben Hutchings <ben@decadent.org.uk>, <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Michal Hocko <mhocko@suse.com>, <stable@vger.kernel.org>
Subject: Re: [PATCH] memcg: Fix thresholds for 32b architectures.
Date: Tue, 27 Oct 2015 18:22:03 +0300	[thread overview]
Message-ID: <20151027152203.GG13221@esperanza> (raw)
In-Reply-To: <1445942234-11175-1-git-send-email-mhocko@kernel.org>

On Tue, Oct 27, 2015 at 11:37:14AM +0100, mhocko@kernel.org wrote:
> From: Michal Hocko <mhocko@suse.com>
> 
> 424cdc141380 ("memcg: convert threshold to bytes") has fixed a
> regression introduced by 3e32cb2e0a12 ("mm: memcontrol: lockless page
> counters") where thresholds were silently converted to use page units
> rather than bytes when interpreting the user input.
> 
> The fix is not complete, though, as properly pointed out by Ben
> Hutchings during stable backport review. The page count is converted
> to bytes but unsigned long is used to hold the value which would
> be obviously not sufficient for 32b systems with more than 4G
> thresholds. The same applies to usage as taken from mem_cgroup_usage
> which might overflow.
> 
> Let's remove this bytes vs. pages internal tracking differences and
> handle thresholds in page units internally. Chage mem_cgroup_usage()
> to return the value in page units and revert 424cdc141380 because this
> should be sufficient for the consistent handling.
> mem_cgroup_read_u64 as the only users of mem_cgroup_usage outside of
> the threshold handling code is converted to give the proper in bytes
> result. It is doing that already for page_counter output so this is
> more consistent as well.
> 
> The value presented to the userspace is still in bytes units.
> 
> Fixes: 424cdc141380 ("memcg: convert threshold to bytes")
> Fixes: 3e32cb2e0a12 ("mm: memcontrol: lockless page counters")
> CC: stable@vger.kernel.org
> Reported-by: Ben Hutchings <ben@decadent.org.uk>
> Signed-off-by: Michal Hocko <mhocko@suse.com>

Reviewed-by: Vladimir Davydov <vdavydov@virtuozzo.com>

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

  reply	other threads:[~2015-10-27 15:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-27 10:37 [PATCH] memcg: Fix thresholds for 32b architectures mhocko
2015-10-27 10:37 ` mhocko
2015-10-27 10:37 ` mhocko
2015-10-27 15:22 ` Vladimir Davydov [this message]
2015-10-27 15:22   ` Vladimir Davydov
2015-10-27 15:22   ` Vladimir Davydov
2015-10-27 16:23 ` Johannes Weiner
2015-10-27 16:23   ` Johannes Weiner
2015-10-27 18:25   ` Michal Hocko
2015-10-27 18:25     ` Michal Hocko

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=20151027152203.GG13221@esperanza \
    --to=vdavydov@virtuozzo.com \
    --cc=akpm@linux-foundation.org \
    --cc=ben@decadent.org.uk \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=mhocko@suse.com \
    --cc=shli@fb.com \
    --cc=stable@vger.kernel.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.