]> Git Repo - linux.git/commit - fs/buffer.c
fs, mm: account buffer_head to kmemcg
authorShakeel Butt <[email protected]>
Fri, 17 Aug 2018 22:46:44 +0000 (15:46 -0700)
committerLinus Torvalds <[email protected]>
Fri, 17 Aug 2018 23:20:30 +0000 (16:20 -0700)
commitf745c6f5fe75734f3b35d9d4e6ebe2a7d010ddda
tree43ca4ae252cd6d4b6b8f4493183cca79d77a6762
parentd46eb14b735b11927d4bdc2d1854c311af19de6d
fs, mm: account buffer_head to kmemcg

The buffer_head can consume a significant amount of system memory and is
directly related to the amount of page cache.  In our production
environment we have observed that a lot of machines are spending a
significant amount of memory as buffer_head and can not be left as
system memory overhead.

Charging buffer_head is not as simple as adding __GFP_ACCOUNT to the
allocation.  The buffer_heads can be allocated in a memcg different from
the memcg of the page for which buffer_heads are being allocated.  One
concrete example is memory reclaim.  The reclaim can trigger I/O of
pages of any memcg on the system.  So, the right way to charge
buffer_head is to extract the memcg from the page for which buffer_heads
are being allocated and then use targeted memcg charging API.

[[email protected]: use __GFP_ACCOUNT for directed memcg charging]
Link: http://lkml.kernel.org/r/[email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Shakeel Butt <[email protected]>
Acked-by: Johannes Weiner <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Jan Kara <[email protected]>
Cc: Amir Goldstein <[email protected]>
Cc: Greg Thelen <[email protected]>
Cc: Vladimir Davydov <[email protected]>
Cc: Roman Gushchin <[email protected]>
Cc: Alexander Viro <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
fs/buffer.c
include/linux/memcontrol.h
mm/memcontrol.c
This page took 0.049425 seconds and 4 git commands to generate.