* [PATCH] mm/memcg: avoid page count check for zone device
@ 2017-09-14 19:00 jglisse
2017-09-15 7:01 ` Michal Hocko
0 siblings, 1 reply; 4+ messages in thread
From: jglisse @ 2017-09-14 19:00 UTC (permalink / raw)
To: linux-mm
Cc: linux-kernel, Jérôme Glisse, Andrew Morton,
Johannes Weiner, Michal Hocko, Vladimir Davydov
From: JA(C)rA'me Glisse <jglisse@redhat.com>
Fix for 4.14, zone device page always have an elevated refcount
of one and thus page count sanity check in uncharge_page() is
inappropriate for them.
Signed-off-by: JA(C)rA'me Glisse <jglisse@redhat.com>
Reported-by: Evgeny Baskakov <ebaskakov@nvidia.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
---
mm/memcontrol.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 15af3da5af02..d51d3e1f49c9 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5648,7 +5648,8 @@ static void uncharge_batch(const struct uncharge_gather *ug)
static void uncharge_page(struct page *page, struct uncharge_gather *ug)
{
VM_BUG_ON_PAGE(PageLRU(page), page);
- VM_BUG_ON_PAGE(!PageHWPoison(page) && page_count(page), page);
+ VM_BUG_ON_PAGE(!PageHWPoison(page) && !is_zone_device_page(page) &&
+ page_count(page), page);
if (!page->mem_cgroup)
return;
--
2.13.5
--
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] 4+ messages in thread
* Re: [PATCH] mm/memcg: avoid page count check for zone device
2017-09-14 19:00 [PATCH] mm/memcg: avoid page count check for zone device jglisse
@ 2017-09-15 7:01 ` Michal Hocko
2017-09-17 17:45 ` Jerome Glisse
0 siblings, 1 reply; 4+ messages in thread
From: Michal Hocko @ 2017-09-15 7:01 UTC (permalink / raw)
To: jglisse
Cc: linux-mm, linux-kernel, Andrew Morton, Johannes Weiner,
Vladimir Davydov
On Thu 14-09-17 15:00:11, jglisse@redhat.com wrote:
> From: Jerome Glisse <jglisse@redhat.com>
>
> Fix for 4.14, zone device page always have an elevated refcount
> of one and thus page count sanity check in uncharge_page() is
> inappropriate for them.
>
> Signed-off-by: Jerome Glisse <jglisse@redhat.com>
> Reported-by: Evgeny Baskakov <ebaskakov@nvidia.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Michal Hocko <mhocko@kernel.org>
> Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Side note. Wouldn't it be better to re-organize the check a bit? It is
true that this is VM_BUG so it is not usually compiled in but when it
preferably checks for unlikely cases first while the ref count will be
0 in the prevailing cases. So can we have
VM_BUG_ON_PAGE(page_count(page) && !is_zone_device_page(page) &&
!PageHWPoison(page), page);
I would simply fold this nano optimization into the patch as you are
touching it already. Not sure it is worth a separate commit.
> ---
> mm/memcontrol.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 15af3da5af02..d51d3e1f49c9 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -5648,7 +5648,8 @@ static void uncharge_batch(const struct uncharge_gather *ug)
> static void uncharge_page(struct page *page, struct uncharge_gather *ug)
> {
> VM_BUG_ON_PAGE(PageLRU(page), page);
> - VM_BUG_ON_PAGE(!PageHWPoison(page) && page_count(page), page);
> + VM_BUG_ON_PAGE(!PageHWPoison(page) && !is_zone_device_page(page) &&
> + page_count(page), page);
>
> if (!page->mem_cgroup)
> return;
> --
> 2.13.5
--
Michal Hocko
SUSE Labs
--
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] 4+ messages in thread
* Re: [PATCH] mm/memcg: avoid page count check for zone device
2017-09-15 7:01 ` Michal Hocko
@ 2017-09-17 17:45 ` Jerome Glisse
2017-09-18 6:31 ` Michal Hocko
0 siblings, 1 reply; 4+ messages in thread
From: Jerome Glisse @ 2017-09-17 17:45 UTC (permalink / raw)
To: Michal Hocko
Cc: linux-mm, linux-kernel, Andrew Morton, Johannes Weiner,
Vladimir Davydov
On Fri, Sep 15, 2017 at 09:01:00AM +0200, Michal Hocko wrote:
> On Thu 14-09-17 15:00:11, jglisse@redhat.com wrote:
> > From: Jerome Glisse <jglisse@redhat.com>
> >
> > Fix for 4.14, zone device page always have an elevated refcount
> > of one and thus page count sanity check in uncharge_page() is
> > inappropriate for them.
> >
> > Signed-off-by: Jerome Glisse <jglisse@redhat.com>
> > Reported-by: Evgeny Baskakov <ebaskakov@nvidia.com>
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Cc: Johannes Weiner <hannes@cmpxchg.org>
> > Cc: Michal Hocko <mhocko@kernel.org>
> > Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
>
> Acked-by: Michal Hocko <mhocko@suse.com>
>
> Side note. Wouldn't it be better to re-organize the check a bit? It is
> true that this is VM_BUG so it is not usually compiled in but when it
> preferably checks for unlikely cases first while the ref count will be
> 0 in the prevailing cases. So can we have
> VM_BUG_ON_PAGE(page_count(page) && !is_zone_device_page(page) &&
> !PageHWPoison(page), page);
>
> I would simply fold this nano optimization into the patch as you are
> touching it already. Not sure it is worth a separate commit.
I am traveling sorry for late answer. This nano optimization make sense
Andrew do you want me to respin or should we leave it be ? I don't mind
either way.
Cheers,
Jerome
--
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] 4+ messages in thread
* Re: [PATCH] mm/memcg: avoid page count check for zone device
2017-09-17 17:45 ` Jerome Glisse
@ 2017-09-18 6:31 ` Michal Hocko
0 siblings, 0 replies; 4+ messages in thread
From: Michal Hocko @ 2017-09-18 6:31 UTC (permalink / raw)
To: Jerome Glisse
Cc: linux-mm, linux-kernel, Andrew Morton, Johannes Weiner,
Vladimir Davydov
On Sun 17-09-17 10:45:34, Jerome Glisse wrote:
> On Fri, Sep 15, 2017 at 09:01:00AM +0200, Michal Hocko wrote:
> > On Thu 14-09-17 15:00:11, jglisse@redhat.com wrote:
> > > From: Jerome Glisse <jglisse@redhat.com>
> > >
> > > Fix for 4.14, zone device page always have an elevated refcount
> > > of one and thus page count sanity check in uncharge_page() is
> > > inappropriate for them.
> > >
> > > Signed-off-by: Jerome Glisse <jglisse@redhat.com>
> > > Reported-by: Evgeny Baskakov <ebaskakov@nvidia.com>
> > > Cc: Andrew Morton <akpm@linux-foundation.org>
> > > Cc: Johannes Weiner <hannes@cmpxchg.org>
> > > Cc: Michal Hocko <mhocko@kernel.org>
> > > Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
> >
> > Acked-by: Michal Hocko <mhocko@suse.com>
> >
> > Side note. Wouldn't it be better to re-organize the check a bit? It is
> > true that this is VM_BUG so it is not usually compiled in but when it
> > preferably checks for unlikely cases first while the ref count will be
> > 0 in the prevailing cases. So can we have
> > VM_BUG_ON_PAGE(page_count(page) && !is_zone_device_page(page) &&
> > !PageHWPoison(page), page);
> >
> > I would simply fold this nano optimization into the patch as you are
> > touching it already. Not sure it is worth a separate commit.
>
> I am traveling sorry for late answer. This nano optimization make sense
> Andrew do you want me to respin or should we leave it be ? I don't mind
> either way.
Andrew, could you fold this into the patch then?
---
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-09-18 6:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-14 19:00 [PATCH] mm/memcg: avoid page count check for zone device jglisse
2017-09-15 7:01 ` Michal Hocko
2017-09-17 17:45 ` Jerome Glisse
2017-09-18 6:31 ` Michal Hocko
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).