Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1235620
| From | Andrew Morton <akpm@linux-foundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/5] mm: uncharge kmem pages from generic free_page path |
| Date | 2015-09-30 00:50 +0200 |
| Message-ID | <qebSH-3fs-29@gated-at.bofh.it> (permalink) |
| References | <qcVdg-5WW-5@gated-at.bofh.it> <qcVdg-5WW-21@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Sat, 26 Sep 2015 13:45:53 +0300 Vladimir Davydov <vdavydov@parallels.com> wrote: > Currently, to charge a page to kmemcg one should use alloc_kmem_pages > helper. When the page is not needed anymore it must be freed with > free_kmem_pages helper, which will uncharge the page before freeing it. > Such a design is acceptable for thread info pages and kmalloc large > allocations, which are currently the only users of alloc_kmem_pages, but > it gets extremely inconvenient if one wants to make use of batched free > (e.g. to charge page tables - see release_pages) or page reference > counter (pipe buffers - see anon_pipe_buf_release). > > To overcome this limitation, this patch moves kmemcg uncharge code to > the generic free path and zaps free_kmem_pages helper. To distinguish > kmem pages from other page types, it makes alloc_kmem_pages initialize > page->_mapcount to a special value and introduces a new PageKmem helper, > which returns true if it sees this value. As far as I can tell, this new use of page._mapcount is OK, but... - The documentation for _mapcount needs to be updated (mm_types.h) - Don't believe the documentation! Because someone else may have done what you tried to do. Please manually audit mm/ for _mapcount uses. - One such use is "For recording whether a page is in the buddy system, we set ->_mapcount PAGE_BUDDY_MAPCOUNT_VALUE". Please update the comment for this while you're in there. (Including description of the state's lifetime). - And please update _mapcount docs for PageBalloon() - Why is the code accessing ->_mapcount directly? afaict page_mapcount() and friends will work OK? - The patch adds overhead to all kernels, even non-kmemcg and non-memcg kernels. Bad. Fixable? - PAGE_BUDDY_MAPCOUNT_VALUE, PAGE_BALLOON_MAPCOUNT_VALUE and PAGE_KMEM_MAPCOUNT_VALUE should all be put next to each other so readers can see all the possible values and so we don't get duplicates, etc. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/5] memcg: charge page tables (x86) and pipe buffers Vladimir Davydov <vdavydov@parallels.com> - 2015-09-26 12:50 +0200
[PATCH 1/5] mm: uncharge kmem pages from generic free_page path Vladimir Davydov <vdavydov@parallels.com> - 2015-09-26 12:50 +0200
Re: [PATCH 1/5] mm: uncharge kmem pages from generic free_page path Andrew Morton <akpm@linux-foundation.org> - 2015-09-30 00:50 +0200
Re: [PATCH 1/5] mm: uncharge kmem pages from generic free_page path Vladimir Davydov <vdavydov@virtuozzo.com> - 2015-09-30 18:50 +0200
Re: [PATCH 1/5] mm: uncharge kmem pages from generic free_page path Greg Thelen <gthelen@google.com> - 2015-09-30 22:00 +0200
Re: [PATCH 1/5] mm: uncharge kmem pages from generic free_page path Vladimir Davydov <vdavydov@virtuozzo.com> - 2015-10-01 21:00 +0200
csiph-web