lkml.org 
[lkml]   [2018]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 05/13] swap,blkcg: issue swap io with the appropriate context
On Tue, May 29, 2018 at 05:17:16PM -0400, Josef Bacik wrote:
> From: Tejun Heo <tj@kernel.org>
>
> For backcharging we need to know who the page belongs to when swapping
> it out.
>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Signed-off-by: Josef Bacik <jbacik@fb.com>
> ---
> mm/page_io.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/mm/page_io.c b/mm/page_io.c
> index a552cb37e220..61e1268e5dbc 100644
> --- a/mm/page_io.c
> +++ b/mm/page_io.c
> @@ -339,6 +339,16 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc,
> goto out;
> }
> bio->bi_opf = REQ_OP_WRITE | REQ_SWAP | wbc_to_write_flags(wbc);
> +#if defined(CONFIG_MEMCG) && defined(CONFIG_BLK_CGROUP)
> + if (page->mem_cgroup) {
> + struct cgroup_subsys_state *blkcg_css;
> +
> + blkcg_css = cgroup_get_e_css(page->mem_cgroup->css.cgroup,
> + &io_cgrp_subsys);
> + bio_associate_blkcg(bio, blkcg_css);
> + css_put(blkcg_css);
> + }
> +#endif

This looks reasonable, but it probably warrants a helper function.

bio_associate_blkcg_from_page() or something?

\
 
 \ /
  Last update: 2018-05-30 15:05    [W:0.207 / U:1.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site