Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1327149 > unrolled thread
| Started by | Johannes Weiner <hannes@cmpxchg.org> |
|---|---|
| First post | 2016-02-04 21:10 +0100 |
| Last post | 2016-02-07 20:00 +0100 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 2/2] mm: memcontrol: drop unnecessary lru locking from mem_cgroup_migrate() Johannes Weiner <hannes@cmpxchg.org> - 2016-02-04 21:10 +0100
Re: [PATCH 2/2] mm: memcontrol: drop unnecessary lru locking from mem_cgroup_migrate() Vladimir Davydov <vdavydov@virtuozzo.com> - 2016-02-07 19:50 +0100
Re: [PATCH 2/2] mm: memcontrol: drop unnecessary lru locking from mem_cgroup_migrate() Johannes Weiner <jweiner@fb.com> - 2016-02-07 20:00 +0100
| From | Johannes Weiner <hannes@cmpxchg.org> |
|---|---|
| Date | 2016-02-04 21:10 +0100 |
| Subject | [PATCH 2/2] mm: memcontrol: drop unnecessary lru locking from mem_cgroup_migrate() |
| Message-ID | <qYyo1-6KS-3@gated-at.bofh.it> |
Migration accounting in the memory controller used to have to handle
both oldpage and newpage being on the LRU already; fuse's page cache
replacement used to pass a recycled newpage that had been uncharged
but not freed and removed from the LRU, and the memcg migration code
used to uncharge oldpage to "pass on" the existing charge to newpage.
Nowadays, pages are no longer uncharged when truncated from the page
cache, but rather only at free time, so if a LRU page is recycled in
page cache replacement it'll also still be charged. And we bail out of
the charge transfer altogether in that case. Tell commit_charge() that
we know newpage is not on the LRU, to avoid taking the zone->lru_lock
unnecessarily from the migration path.
But also, oldpage is no longer uncharged inside migration. We only use
oldpage for its page->mem_cgroup and page size, so we don't care about
its LRU state anymore either. Remove any mention from the kernel doc.
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Suggested-by: Hugh Dickins <hughd@google.com>
---
mm/memcontrol.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 3e4199830456..42882c1e7fce 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5489,7 +5489,6 @@ void mem_cgroup_uncharge_list(struct list_head *page_list)
* be uncharged upon free.
*
* Both pages must be locked, @newpage->mapping must be set up.
- * Either or both pages might be on the LRU already.
*/
void mem_cgroup_migrate(struct page *oldpage, struct page *newpage)
{
@@ -5524,7 +5523,7 @@ void mem_cgroup_migrate(struct page *oldpage, struct page *newpage)
page_counter_charge(&memcg->memsw, nr_pages);
css_get_many(&memcg->css, nr_pages);
- commit_charge(newpage, memcg, true);
+ commit_charge(newpage, memcg, false);
local_irq_disable();
mem_cgroup_charge_statistics(memcg, newpage, compound, nr_pages);
--
2.7.0
[toc] | [next] | [standalone]
| From | Vladimir Davydov <vdavydov@virtuozzo.com> |
|---|---|
| Date | 2016-02-07 19:50 +0100 |
| Subject | Re: [PATCH 2/2] mm: memcontrol: drop unnecessary lru locking from mem_cgroup_migrate() |
| Message-ID | <qZCzg-1PA-17@gated-at.bofh.it> |
| In reply to | #1327149 |
On Thu, Feb 04, 2016 at 03:07:47PM -0500, Johannes Weiner wrote: > Migration accounting in the memory controller used to have to handle > both oldpage and newpage being on the LRU already; fuse's page cache > replacement used to pass a recycled newpage that had been uncharged > but not freed and removed from the LRU, and the memcg migration code > used to uncharge oldpage to "pass on" the existing charge to newpage. > > Nowadays, pages are no longer uncharged when truncated from the page > cache, but rather only at free time, so if a LRU page is recycled in > page cache replacement it'll also still be charged. And we bail out of > the charge transfer altogether in that case. Tell commit_charge() that > we know newpage is not on the LRU, to avoid taking the zone->lru_lock > unnecessarily from the migration path. > > But also, oldpage is no longer uncharged inside migration. We only use > oldpage for its page->mem_cgroup and page size, so we don't care about > its LRU state anymore either. Remove any mention from the kernel doc. > > Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> > Suggested-by: Hugh Dickins <hughd@google.com> Acked-by: Vladimir Davydov <vdavydov@virtuozzo.com> Nit: diff --git a/mm/memcontrol.c b/mm/memcontrol.c index ae8b81c55685..120118f3ce0a 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -5483,6 +5483,7 @@ void mem_cgroup_migrate(struct page *oldpage, struct page *newpage) unsigned int nr_pages; bool compound; + VM_BUG_ON_PAGE(PageLRU(newpage), newpage); VM_BUG_ON_PAGE(!PageLocked(oldpage), oldpage); VM_BUG_ON_PAGE(!PageLocked(newpage), newpage); VM_BUG_ON_PAGE(PageAnon(oldpage) != PageAnon(newpage), newpage);
[toc] | [prev] | [next] | [standalone]
| From | Johannes Weiner <jweiner@fb.com> |
|---|---|
| Date | 2016-02-07 20:00 +0100 |
| Subject | Re: [PATCH 2/2] mm: memcontrol: drop unnecessary lru locking from mem_cgroup_migrate() |
| Message-ID | <qZCIW-1TN-3@gated-at.bofh.it> |
| In reply to | #1328557 |
> On Feb 7, 2016, at 1:41 PM, Vladimir Davydov <vdavydov@virtuozzo.com> wrote: > >> On Thu, Feb 04, 2016 at 03:07:47PM -0500, Johannes Weiner wrote: >> Migration accounting in the memory controller used to have to handle >> both oldpage and newpage being on the LRU already; fuse's page cache >> replacement used to pass a recycled newpage that had been uncharged >> but not freed and removed from the LRU, and the memcg migration code >> used to uncharge oldpage to "pass on" the existing charge to newpage. >> >> Nowadays, pages are no longer uncharged when truncated from the page >> cache, but rather only at free time, so if a LRU page is recycled in >> page cache replacement it'll also still be charged. And we bail out of >> the charge transfer altogether in that case. Tell commit_charge() that >> we know newpage is not on the LRU, to avoid taking the zone->lru_lock >> unnecessarily from the migration path. >> >> But also, oldpage is no longer uncharged inside migration. We only use >> oldpage for its page->mem_cgroup and page size, so we don't care about >> its LRU state anymore either. Remove any mention from the kernel doc. >> >> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> >> Suggested-by: Hugh Dickins <hughd@google.com> > > Acked-by: Vladimir Davydov <vdavydov@virtuozzo.com> Thanks! > @@ -5483,6 +5483,7 @@ void mem_cgroup_migrate(struct page *oldpage, struct page *newpage) > unsigned int nr_pages; > bool compound; > > + VM_BUG_ON_PAGE(PageLRU(newpage), newpage); That's actually possible for fuse. But in that case newpage is charged and we bail.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web