From patchwork Tue May 29 21:17:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 10437159 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 45DD4602BF for ; Tue, 29 May 2018 21:21:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 379322897F for ; Tue, 29 May 2018 21:21:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2971A2899C; Tue, 29 May 2018 21:21:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC3752897F for ; Tue, 29 May 2018 21:21:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967425AbeE2VU2 (ORCPT ); Tue, 29 May 2018 17:20:28 -0400 Received: from mail-qt0-f193.google.com ([209.85.216.193]:34397 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967154AbeE2VRf (ORCPT ); Tue, 29 May 2018 17:17:35 -0400 Received: by mail-qt0-f193.google.com with SMTP id m5-v6so20627697qti.1 for ; Tue, 29 May 2018 14:17:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=PN/nWKQLg21E/rV05t1OoXBNqfvsbn3JrFEdFIuPAYQ=; b=W34Q8/aKBX/6YXFAvZB3haDDoRmC3DTSKid8xBURzXPA/5Oke3emCvD0yLAJSeKFCW QRxlemMpVFYdxZE3AkfNJ+/easTLtVqbEV8Qsfd5BsGbSj1gF6bK+da4pTpoykcTU57q Ey7tTlrfQi76OIm8S6KqFlyrMAKY+TZajEzyo1SjOm+9tn6Vhe1xQM5jycs6y3rRi/4r zkG4AVNyZ2E3NCpbkf5PPgNYjOqD3DUPajFEEZMhuhjjXXXS0urwgJDRhaRpiE50sL/f DDE8Z7vD+KEEhj0ZHl7zxV5jH4g6qlgJkYhtqVNG/nc7rLvpIzXRD3a572cLJ4bJBWPo sR1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=PN/nWKQLg21E/rV05t1OoXBNqfvsbn3JrFEdFIuPAYQ=; b=BypIfIerlcLY8ONjbnHtJXlVhRw/Zo4N8FgMcFOiwR6DW3yS1JUQ01chMpdgUrfE4+ Ie7/qL0SIchOyY3BHxSqOtm20W+5V1XkpCUHawfhEuwb4t5DTzy0HDSpNY6UVh5L2Azb CcriNnSexO36+7duZqVlAxLHtFN6e2Imjom6nCPb+dKAkVQ6dXXDeU0Mh7s6uAE4/Xe8 mRK4e1fjw840CFbmZ6OxY38KERzFym4hzQsz5BQ9VNYdJiYgztGJPY2S0tjJDVXcY7KF P+bNJB1CfwFz7Tuiumv5KthKvOAWxUkBLLr6EYN4LvscaSEkxi8YRnvZQhnNE/kmHz1w A/9g== X-Gm-Message-State: APt69E2hDCcIdX4UJIE17jSLLsBUaULaYi06kDyWGIQJ9/di9zNxYXx0 S2XwzLVG4bn7f6BX9PL2JJ0eTA== X-Google-Smtp-Source: ADUXVKJeWmMLx5ZuE+IcTSuh3RBDVubhd3d+6lx7Q/yHSizuSngCDVAPYfAevChwgZtdVduNU7tBsQ== X-Received: by 2002:a0c:de05:: with SMTP id t5-v6mr81380qvk.180.1527628654948; Tue, 29 May 2018 14:17:34 -0700 (PDT) Received: from localhost (cpe-2606-A000-4381-1201-225-22FF-FEB3-E51A.dyn6.twc.com. [2606:a000:4381:1201:225:22ff:feb3:e51a]) by smtp.gmail.com with ESMTPSA id 3-v6sm10641280qtx.16.2018.05.29.14.17.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 May 2018 14:17:34 -0700 (PDT) From: Josef Bacik To: axboe@kernel.dk, kernel-team@fb.com, linux-block@vger.kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org, hannes@cmpxchg.org, linux-kernel@vger.kernel.org, tj@kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 05/13] swap, blkcg: issue swap io with the appropriate context Date: Tue, 29 May 2018 17:17:16 -0400 Message-Id: <20180529211724.4531-6-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180529211724.4531-1-josef@toxicpanda.com> References: <20180529211724.4531-1-josef@toxicpanda.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 count_swpout_vm_event(page); set_page_writeback(page); unlock_page(page);