Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4636316imm; Wed, 30 May 2018 09:06:23 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIIS3behcj16gMJZcho1fWu155ZIRkZVIduMro1xVlfCgH0o4+J/tst64Ah3fxHfvfvhNID X-Received: by 2002:aa7:8609:: with SMTP id p9-v6mr3302023pfn.123.1527696383738; Wed, 30 May 2018 09:06:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527696383; cv=none; d=google.com; s=arc-20160816; b=eiIn7zd6uGWZAjyFtJYeXyuqS7/xmHF204n+3SteSPYi1eQN/rBaP8xmAYn00wTVJk 4fEwPrsMwV1BMYQwGr3VmZQJbGMNcNxRp2jovVv9ZyScddIBpEWMUD54kGdgixgVBfgy b4afHx4VaXlOsCCqs0nsslF2LNKrIcekAGmxqMJGpX4r+YpBXU5Stnmcgk5pnPf6z1vA 9Ti1xSZVolAQvaQxRb+swZZtndokED6s72AUHf5R6wVNQqa6/9lyN/beZna8Lyr9UfJT zrhgIMJBia0sPxYuLR/jgpdb7MsSqLoe1t2Bo997AsQgGOLiNYIdZh16Bc+7dmAHbjC+ lUtQ== 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=yniQtrG8hPvdrNy4UcLUz/8xJ4hUK1MaU3fCQ6djniY=; b=gVFwjiuEnvv9qr3OF+Fa2CUFS6MSqeqJx+r6Nd7GTZ5D75+/G/rQ4JCBtmncs1JBr2 uuhOf99fL9x1zJWd8lz2jn4JLSTv1Dj4xLIoLvNqWWtDwoaH7IMAlutL7nUe6ZQLG9D2 TJy/KkOGtjDSMgFE68Tj73RRFdRjnbR5VYFdMIDvYUDgJyKYpqiP1a4vyIOA1SW+47Vp yMc5JtU4g3He7wcLhIx3vMCKVAbOfuKeIKZKeLwdaQ140tZaqa4h57LhwxLK9PKAN29L zqK/LdRABn62oahf7kNEq5DHUYE8elQ93AnFSOB0MGhVrfASd2jjkwxhYBMii4fNHbQ5 A0dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=YrvEo2hU; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c27-v6si4336420pgn.320.2018.05.30.09.06.09; Wed, 30 May 2018 09:06:23 -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=@gmail.com header.s=20161025 header.b=YrvEo2hU; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753719AbeE3QFd (ORCPT + 99 others); Wed, 30 May 2018 12:05:33 -0400 Received: from mail-yb0-f193.google.com ([209.85.213.193]:33144 "EHLO mail-yb0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750905AbeE3QFa (ORCPT ); Wed, 30 May 2018 12:05:30 -0400 Received: by mail-yb0-f193.google.com with SMTP id x36-v6so6537094ybi.0; Wed, 30 May 2018 09:05:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=yniQtrG8hPvdrNy4UcLUz/8xJ4hUK1MaU3fCQ6djniY=; b=YrvEo2hUA9ozkrWHrHIKiuIceNOv9M1kCJ1zl2ZRWFpwFdCBZy0gn29XIsLybFK2aE IIbg68Ifqh92HsJDQ9V8zdKLlXMFXa1tsoXTPL9XxGB/2Re2x/QWpqdWfq10fh7MZQBv 0X505taWjSQ6yKNL6NTV1NdwqZFgBvgL7uNmnwQsdyVDhXCxh00jvh1b0YLKj4FQ+Q53 nQ5mXhLzJ3ImM+TJoMH8BpXBVS8bKCSregxNAnR/EVgD6MOz63HPgdyaaXPfYYD6KDNu LBrmQ6OgAflc6xSth9N5IRwteu2AYTTeWby+Ouk/W6jpzwVsDbm7ovmuSM2T+lo/fUAS jwrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=yniQtrG8hPvdrNy4UcLUz/8xJ4hUK1MaU3fCQ6djniY=; b=paWrk5uG9PNSADkliMiARkROVtqVnIfcf8Q7eBpQIIxWjgtUVfgSi/zD7cVaPKTXQC F9Y33enEkKgFx8wbg39SCmikPLSUuCNFkJ51Uqw3wSXjHq+1cTSOsJdEw3wNttB7O9VD 2QDDDBG8H3OHyZ6mo6x7jWzTAA9gBFzHkvAxosDm42paZfdnLHaqpE4LGW6MXGhJbK9D qMilaGLFuGMAMJvJZ4xSfaus6V3i0/H9TEL5lH9tKagqEQSub2qJE5bzy4TUcQuQE0iY Rv/SHcmzPyFW26beApyuDwHY5pVBQE3Dy/P3xeLKhZedptrwDgwZo6gq/6S2EYEzjCvr aCJw== X-Gm-Message-State: ALKqPwfXCBxNDCe8068Fi7vIqAwN/dEdn+ahqPmwCQdkxX0vQCIomcCe NAgCkuAcqIpOzNljHWNPksI= X-Received: by 2002:a25:6297:: with SMTP id w145-v6mr1908670ybb.281.1527696330042; Wed, 30 May 2018 09:05:30 -0700 (PDT) Received: from localhost ([2620:10d:c091:180::1:6002]) by smtp.gmail.com with ESMTPSA id 138-v6sm12388194ywq.6.2018.05.30.09.05.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 May 2018 09:05:29 -0700 (PDT) Date: Wed, 30 May 2018 09:05:27 -0700 From: Tejun Heo To: Josef Bacik Cc: 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, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 05/13] swap,blkcg: issue swap io with the appropriate context Message-ID: <20180530160527.GM1351649@devbig577.frc2.facebook.com> 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.5.21 (2010-09-15) 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 So, this ignores the cases where bdev_write_page() is the one which does the writes. If my reading is correct, only brd, zram, btt and pmem implement bdev_ops->rw_page() and take bdev_write_page() path, so it shouldn't be a problem in majority of cases. I don't think we need to address ->rw_page() case right now but it might be a good idea to add a comment explaining the ommission. Thanks. -- tejun