Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4456042imm; Wed, 30 May 2018 06:05:45 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLqmwkSKHgDAq0M8Uy+JVDJB0VkCW+HV8tyUo1s62cPeB0BhnHF7INepS04HPIwZ3GFDSdt X-Received: by 2002:a62:c4dd:: with SMTP id h90-v6mr2775164pfk.86.1527685545505; Wed, 30 May 2018 06:05:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527685545; cv=none; d=google.com; s=arc-20160816; b=ajMMMiGKC1Oh2B6TYl/gGqoSNTkDWcgQuFi/wpJgrMbqhuD5opQtFlU6rFBIa5o0Xc 9pjmGX3VwMdaBPCCdB5UE/erJEDeWVhPqJy9IDd/Gg2FWr0sg5IbuL4sfABgyJnVMiV6 56RCCkBvYU8L5JT2BHcMkh62cgTXDYeRbpEOBeqolCLQneGfsFwekQvZmXl1R0mZe5iI 2SmaMdmOfKI0qY3indKFz8Z2LsZOcUVmOvJDsB1mEQW++hpLffvcu7ZQjznnGoSlHhFJ 5824rKWkyG2rixzeG12Jsb6tbFTxxtwoloj29MBMNFKOO88+FjCo3IZdrjqKdhNMe77x yv7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=8Iwa8s37848zixIAfOeXmPo+krk2hDkNzFnMyouJHic=; b=MEJhRdJ7cLf0kYZsJRdXUIOUKH4AV9OBu5FFiyFMX5X+M4WWRojXH4vzKXnXzXfZQw nVLQlGTNmzO8iXi1ahups+0cF+Xxb8zM8a6yyK+7ehcmyhychpKneiMWoq4t6I7pK9fy Oj/O66+3I+X35Wqf12rVElP8T9zzVYNwrY+5V1kpYTbbjHogVBJZryQkozYlUxo1cdbF 9Jfx1kx8zvkdhTHQxjaLCXNp9cxducvjj57JoFP8JIcALFtkQ4Yo9LdD00pquQXBm3yC zkbaH37kLqUMpVvSa9Auxvga+qAFHv8wnT7SXayYqlmOZz4cvDb90J5tufCCcrb6zyFA 13Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@cmpxchg.org header.s=x header.b=r8MTXIJc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p18-v6si15702232pgu.510.2018.05.30.06.05.17; Wed, 30 May 2018 06:05:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@cmpxchg.org header.s=x header.b=r8MTXIJc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752850AbeE3NEn (ORCPT + 99 others); Wed, 30 May 2018 09:04:43 -0400 Received: from gum.cmpxchg.org ([85.214.110.215]:52740 "EHLO gum.cmpxchg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751771AbeE3NEl (ORCPT ); Wed, 30 May 2018 09:04:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=cmpxchg.org ; s=x; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject: Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=8Iwa8s37848zixIAfOeXmPo+krk2hDkNzFnMyouJHic=; b=r8MTXIJcWi0YUDJDbuLH4JKKkt K8r6Ho7HlzX+ylqL2tBONU1pFHMwLJMGv81NSFvCAXMvFon9umkt8MU7PWpkzJ19S7aNx2M+V0OyX 9IDUgp2Vsmqt0rbBHKWuPjWFCjcfY1P6D02R9v+f1LjcTeKQcbQTepueHGqojHliKUQg=; Date: Wed, 30 May 2018 09:06:48 -0400 From: Johannes Weiner To: Josef Bacik Cc: axboe@kernel.dk, kernel-team@fb.com, linux-block@vger.kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, tj@kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 05/13] swap,blkcg: issue swap io with the appropriate context Message-ID: <20180530130648.GA4035@cmpxchg.org> References: <20180529211724.4531-1-josef@toxicpanda.com> <20180529211724.4531-6-josef@toxicpanda.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180529211724.4531-6-josef@toxicpanda.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 29, 2018 at 05:17:16PM -0400, Josef Bacik wrote: > From: Tejun Heo > > For backcharging we need to know who the page belongs to when swapping > it out. > > Signed-off-by: Tejun Heo > Signed-off-by: Josef Bacik > --- > 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?