Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5695867ybl; Tue, 27 Aug 2019 08:24:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqwib8+CZCOAA/rH3eA9p4CjOuaA7IT5tnxBDMAwD3bfNZh7r5pN5TvvfTaJBsjh2MKdZbHL X-Received: by 2002:a63:e148:: with SMTP id h8mr21762399pgk.275.1566919493718; Tue, 27 Aug 2019 08:24:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566919493; cv=none; d=google.com; s=arc-20160816; b=1KnSZIGKtFnW2+Pg1ybwQd0fX7E94dkw0qkiku+814oYbCuttcAYuzlvSC/Nk/3khm r8D1FOvCKQPpzlCs9M5osiyFweVInYYfd0ZE7edI3hhFs1Y5m5nQo56UgLXuzpfHy9fY Cnb04/ClsgdNITLzMmwbl/kLekwXEiktRg0F2fZcI0N95UfjuNbgAgm9J4pulH/0unbD 3tu1RTIYgM7C2sciNXQwQjoK7yR9aJn0dNgjHEJYc9+stbEENL4FlWJrf1v5MBsYJkAZ 9JufLMGbDs+7jTt+vWCdWKyff+ByvX0DM60zOBdh9UAMBMEqYvDgyFbs2epJjOwgN32G LH9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=EialagdAgnBtYjzH6H0eO9CyoHJZ48U2U5aIVIJeUoo=; b=llrG5oyvQAO3cyHF44BvfzxtNz1IQBqa8wRK/vlV4mysmg021S/stD0SO0/Rj9Tm2u P999FcS/fxm/l7eyflvHnbwd1jcypwb2Wb37d+uMs36ViQCzBbZnUdUIXX9rZc88/g60 whWYLQiQ+GpRZGeKKoSBtP892XmHq3tSIb/pZ1TzhuXcFTi/8MayFyE6Q07HJ6/MTPVU 2TiuRHGYPdbJaLn8pwr9xEhlOOfZVJBP4OfPdbk50XoDgY2h3hggDnYwq+VRHZCPa78i HoZc0E9wo4FqfgrpEde1XSRWvHrjKCMghM1KWwu/kbhfxqds/0a46vFXD5QssI5u4s8/ bjQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b="figx/Q98"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5si4141736plz.51.2019.08.27.08.24.37; Tue, 27 Aug 2019 08:24:53 -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=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b="figx/Q98"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730095AbfH0PXN (ORCPT + 99 others); Tue, 27 Aug 2019 11:23:13 -0400 Received: from mail-io1-f48.google.com ([209.85.166.48]:40258 "EHLO mail-io1-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727064AbfH0PXM (ORCPT ); Tue, 27 Aug 2019 11:23:12 -0400 Received: by mail-io1-f48.google.com with SMTP id t6so47227779ios.7 for ; Tue, 27 Aug 2019 08:23:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=EialagdAgnBtYjzH6H0eO9CyoHJZ48U2U5aIVIJeUoo=; b=figx/Q98kEpCBkqo3lxQ6atjRtKnOZ/vizqGhR6ya8V3vn3+aFl2oTLswEK1VjnEMg An75CIk3RkB52JqKH80uhifoZiBjBgP+rPZNgE/8ipmRd77Ok9Xb6Y+4IeWDeVn8lmKd ySMOZk1uc2qMWNtBcJuL843WNs9SFPe/F1JQBw+7MCJe3UdkDKvttcuwKgwAi9oppUSI vRtaD9Uy56A0NEqyv6qNzLxcz1F6B3uV/Dp3f7ve6N1FqXtz+1EzyKNRy7GFif41nKI3 nQoC9QQViIIaBRegMiHx06KhObDFDXWzNvmgR56X0UTpzB2kBNE2KFkzbQ9//Alh90Yc O4RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=EialagdAgnBtYjzH6H0eO9CyoHJZ48U2U5aIVIJeUoo=; b=CgWMNwxHDIvKfYLe5K/sZFGqcXozhoU+14/cLu2Q2hj4m78W3y+8BPm0vKSY2frTo5 oQC95ps5cybuZejGNjOHHnuKp8umI9tNeD5FNMwX6RzH+vc2eOcqB0p23LgYsLYstzTI VK9Uh0uYKZoDbIXO57LiBpJFbK5Ahip2SL55/VSJut3895EmMxZlk2dvAsxC4aI7gUXq 1IGEXzPYsohk9u6XkGIRYjWjftn6AA1uNuC1FZZcHeqKbrsA/uBB3rkqbsV1t7b6LLFu zIxb//odtObAx8TL1xzVPWZ02IqDcfCE1Y77xPTI/yYiKgbSJHPcTjXw0bOb60dpVlbs cVOA== X-Gm-Message-State: APjAAAWgB17wPqWmJgi0sql9Ozdyjl2n2IX9xN//wZko1A7xGfOywH6a 5WFYIg0QVrYJZ6fNZu0kzJpkWQ== X-Received: by 2002:a6b:3943:: with SMTP id g64mr24044809ioa.225.1566919391746; Tue, 27 Aug 2019 08:23:11 -0700 (PDT) Received: from [192.168.1.50] ([65.144.74.34]) by smtp.gmail.com with ESMTPSA id u24sm13275659iot.38.2019.08.27.08.23.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Aug 2019 08:23:10 -0700 (PDT) Subject: Re: [PATCHSET v3] writeback, memcg: Implement foreign inode flushing To: Tejun Heo , jack@suse.cz, hannes@cmpxchg.org, mhocko@kernel.org, vdavydov.dev@gmail.com Cc: cgroups@vger.kernel.org, linux-mm@kvack.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, guro@fb.com, akpm@linux-foundation.org References: <20190826160656.870307-1-tj@kernel.org> From: Jens Axboe Message-ID: <15a5a6e8-90bf-726b-f68c-db91f1afc651@kernel.dk> Date: Tue, 27 Aug 2019 09:23:09 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190826160656.870307-1-tj@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/26/19 10:06 AM, Tejun Heo wrote: > Hello, > > Changes from v1[1]: > > * More comments explaining the parameters. > > * 0003-writeback-Separate-out-wb_get_lookup-from-wb_get_create.patch > added and avoid spuriously creating missing wbs for foreign > flushing. > > Changes from v2[2]: > > * Added livelock avoidance and applied other smaller changes suggested > by Jan. > > There's an inherent mismatch between memcg and writeback. The former > trackes ownership per-page while the latter per-inode. This was a > deliberate design decision because honoring per-page ownership in the > writeback path is complicated, may lead to higher CPU and IO overheads > and deemed unnecessary given that write-sharing an inode across > different cgroups isn't a common use-case. > > Combined with inode majority-writer ownership switching, this works > well enough in most cases but there are some pathological cases. For > example, let's say there are two cgroups A and B which keep writing to > different but confined parts of the same inode. B owns the inode and > A's memory is limited far below B's. A's dirty ratio can rise enough > to trigger balance_dirty_pages() sleeps but B's can be low enough to > avoid triggering background writeback. A will be slowed down without > a way to make writeback of the dirty pages happen. > > This patchset implements foreign dirty recording and foreign mechanism > so that when a memcg encounters a condition as above it can trigger > flushes on bdi_writebacks which can clean its pages. Please see the > last patch for more details. > > This patchset contains the following four patches. > > 0001-writeback-Generalize-and-expose-wb_completion.patch > 0002-bdi-Add-bdi-id.patch > 0003-writeback-Separate-out-wb_get_lookup-from-wb_get_create.patch > 0004-writeback-memcg-Implement-cgroup_writeback_by_id.patch > 0005-writeback-memcg-Implement-foreign-dirty-flushing.patch > > 0001-0004 are prep patches which expose wb_completion and implement > bdi->id and flushing by bdi and memcg IDs. > > 0005 implements foreign inode flushing. > > Thanks. diffstat follows. > > fs/fs-writeback.c | 130 ++++++++++++++++++++++++++++--------- > include/linux/backing-dev-defs.h | 23 ++++++ > include/linux/backing-dev.h | 5 + > include/linux/memcontrol.h | 39 +++++++++++ > include/linux/writeback.h | 2 > mm/backing-dev.c | 120 +++++++++++++++++++++++++++++----- > mm/memcontrol.c | 134 +++++++++++++++++++++++++++++++++++++++ > mm/page-writeback.c | 4 + > 8 files changed, 404 insertions(+), 53 deletions(-) Applied for 5.4, thanks Tejun. -- Jens Axboe