All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	Vladimir Davydov <vdavydov@virtuozzo.com>,
	Michal Hocko <mhocko@suse.cz>,
	cgroups@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Subject: Re: [PATCH] mm/workingset: do not forget to unlock page
Date: Wed, 3 Feb 2016 13:19:39 -0800	[thread overview]
Message-ID: <20160203131939.1a35d9bc03f13b2b143d27c0@linux-foundation.org> (raw)
In-Reply-To: <20160203162400.GB10440@cmpxchg.org>

On Wed, 3 Feb 2016 11:24:00 -0500 Johannes Weiner <hannes@cmpxchg.org> wrote:

> On Wed, Feb 03, 2016 at 07:41:36PM +0900, Sergey Senozhatsky wrote:
> > From 1d6315221f2f81c53c99f9980158f8ae49dbd582 Mon Sep 17 00:00:00 2001
> > From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> > Date: Wed, 3 Feb 2016 18:49:16 +0900
> > Subject: [PATCH] mm/workingset: do not forget to unlock_page in workingset_activation
> > 
> > Do not return from workingset_activation() with locked rcu and page.
> > 
> > Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> 
> Thanks Sergey. Even though I wrote this function, my brain must have
> gone "it can't be locking anything when it returns NULL, right?" It's
> a dumb interface. Luckily, that's fixed with follow-up patches in -mm.
> 
> As for this one:
> 
> Acked-by: Johannes Weiner <hannes@cmpxchg.org>
> Fixes: mm: workingset: per-cgroup cache thrash detection
> 
> Andrew, can you please fold this?

Yup.  I turned it into a fix against
mm-workingset-per-cgroup-cache-thrash-detection.patch, which is where
the bug was added.  And I did the goto thing instead, so the final
result will be

void workingset_activation(struct page *page)
{
	struct lruvec *lruvec;

	lock_page_memcg(page);
	/*
	 * Filter non-memcg pages here, e.g. unmap can call
	 * mark_page_accessed() on VDSO pages.
	 *
	 * XXX: See workingset_refault() - this should return
	 * root_mem_cgroup even for !CONFIG_MEMCG.
	 */
	if (!mem_cgroup_disabled() && !page_memcg(page))
		goto out;
	lruvec = mem_cgroup_zone_lruvec(page_zone(page), page_memcg(page));
	atomic_long_inc(&lruvec->inactive_age);
out:
	unlock_page_memcg(page);
}

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	Vladimir Davydov <vdavydov@virtuozzo.com>,
	Michal Hocko <mhocko@suse.cz>,
	cgroups@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Subject: Re: [PATCH] mm/workingset: do not forget to unlock page
Date: Wed, 3 Feb 2016 13:19:39 -0800	[thread overview]
Message-ID: <20160203131939.1a35d9bc03f13b2b143d27c0@linux-foundation.org> (raw)
In-Reply-To: <20160203162400.GB10440@cmpxchg.org>

On Wed, 3 Feb 2016 11:24:00 -0500 Johannes Weiner <hannes@cmpxchg.org> wrote:

> On Wed, Feb 03, 2016 at 07:41:36PM +0900, Sergey Senozhatsky wrote:
> > From 1d6315221f2f81c53c99f9980158f8ae49dbd582 Mon Sep 17 00:00:00 2001
> > From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> > Date: Wed, 3 Feb 2016 18:49:16 +0900
> > Subject: [PATCH] mm/workingset: do not forget to unlock_page in workingset_activation
> > 
> > Do not return from workingset_activation() with locked rcu and page.
> > 
> > Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> 
> Thanks Sergey. Even though I wrote this function, my brain must have
> gone "it can't be locking anything when it returns NULL, right?" It's
> a dumb interface. Luckily, that's fixed with follow-up patches in -mm.
> 
> As for this one:
> 
> Acked-by: Johannes Weiner <hannes@cmpxchg.org>
> Fixes: mm: workingset: per-cgroup cache thrash detection
> 
> Andrew, can you please fold this?

Yup.  I turned it into a fix against
mm-workingset-per-cgroup-cache-thrash-detection.patch, which is where
the bug was added.  And I did the goto thing instead, so the final
result will be

void workingset_activation(struct page *page)
{
	struct lruvec *lruvec;

	lock_page_memcg(page);
	/*
	 * Filter non-memcg pages here, e.g. unmap can call
	 * mark_page_accessed() on VDSO pages.
	 *
	 * XXX: See workingset_refault() - this should return
	 * root_mem_cgroup even for !CONFIG_MEMCG.
	 */
	if (!mem_cgroup_disabled() && !page_memcg(page))
		goto out;
	lruvec = mem_cgroup_zone_lruvec(page_zone(page), page_memcg(page));
	atomic_long_inc(&lruvec->inactive_age);
out:
	unlock_page_memcg(page);
}


--
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: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
To: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
Cc: Sergey Senozhatsky
	<sergey.senozhatsky.work-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Vladimir Davydov
	<vdavydov-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>,
	Michal Hocko <mhocko-AlSwsSmVLrQ@public.gmane.org>,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Sergey Senozhatsky
	<sergey.senozhatsky-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH] mm/workingset: do not forget to unlock page
Date: Wed, 3 Feb 2016 13:19:39 -0800	[thread overview]
Message-ID: <20160203131939.1a35d9bc03f13b2b143d27c0@linux-foundation.org> (raw)
In-Reply-To: <20160203162400.GB10440-druUgvl0LCNAfugRpC6u6w@public.gmane.org>

On Wed, 3 Feb 2016 11:24:00 -0500 Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org> wrote:

> On Wed, Feb 03, 2016 at 07:41:36PM +0900, Sergey Senozhatsky wrote:
> > From 1d6315221f2f81c53c99f9980158f8ae49dbd582 Mon Sep 17 00:00:00 2001
> > From: Sergey Senozhatsky <sergey.senozhatsky-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > Date: Wed, 3 Feb 2016 18:49:16 +0900
> > Subject: [PATCH] mm/workingset: do not forget to unlock_page in workingset_activation
> > 
> > Do not return from workingset_activation() with locked rcu and page.
> > 
> > Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> Thanks Sergey. Even though I wrote this function, my brain must have
> gone "it can't be locking anything when it returns NULL, right?" It's
> a dumb interface. Luckily, that's fixed with follow-up patches in -mm.
> 
> As for this one:
> 
> Acked-by: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
> Fixes: mm: workingset: per-cgroup cache thrash detection
> 
> Andrew, can you please fold this?

Yup.  I turned it into a fix against
mm-workingset-per-cgroup-cache-thrash-detection.patch, which is where
the bug was added.  And I did the goto thing instead, so the final
result will be

void workingset_activation(struct page *page)
{
	struct lruvec *lruvec;

	lock_page_memcg(page);
	/*
	 * Filter non-memcg pages here, e.g. unmap can call
	 * mark_page_accessed() on VDSO pages.
	 *
	 * XXX: See workingset_refault() - this should return
	 * root_mem_cgroup even for !CONFIG_MEMCG.
	 */
	if (!mem_cgroup_disabled() && !page_memcg(page))
		goto out;
	lruvec = mem_cgroup_zone_lruvec(page_zone(page), page_memcg(page));
	atomic_long_inc(&lruvec->inactive_age);
out:
	unlock_page_memcg(page);
}


  reply	other threads:[~2016-02-03 21:19 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-03  9:58 [PATCH] mm/workingset: do not forget to unlock page Sergey Senozhatsky
2016-02-03  9:58 ` Sergey Senozhatsky
2016-02-03 10:41 ` Sergey Senozhatsky
2016-02-03 10:41   ` Sergey Senozhatsky
2016-02-03 10:41   ` Sergey Senozhatsky
2016-02-03 16:24   ` Johannes Weiner
2016-02-03 16:24     ` Johannes Weiner
2016-02-03 21:19     ` Andrew Morton [this message]
2016-02-03 21:19       ` Andrew Morton
2016-02-03 21:19       ` Andrew Morton
2016-02-03 22:02       ` Johannes Weiner
2016-02-03 22:02         ` Johannes Weiner
2016-02-03 22:02         ` Johannes Weiner
2016-02-04  0:19         ` Sergey Senozhatsky
2016-02-04  0:19           ` Sergey Senozhatsky
2016-02-04  0:19           ` Sergey Senozhatsky

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=20160203131939.1a35d9bc03f13b2b143d27c0@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=vdavydov@virtuozzo.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.