From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754333AbbBKVWi (ORCPT ); Wed, 11 Feb 2015 16:22:38 -0500 Received: from mail-lb0-f182.google.com ([209.85.217.182]:39082 "EHLO mail-lb0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752945AbbBKVWg (ORCPT ); Wed, 11 Feb 2015 16:22:36 -0500 MIME-Version: 1.0 In-Reply-To: <20150211203359.GF21356@htj.duckdns.org> References: <20150205131514.GD25736@htj.dyndns.org> <20150205222522.GA10580@htj.dyndns.org> <20150206141746.GB10580@htj.dyndns.org> <20150207143839.GA9926@htj.dyndns.org> <20150211021906.GA21356@htj.duckdns.org> <20150211203359.GF21356@htj.duckdns.org> Date: Thu, 12 Feb 2015 00:22:34 +0300 Message-ID: Subject: Re: [RFC] Making memcg track ownership per address_space or anon_vma From: Konstantin Khlebnikov To: Tejun Heo Cc: Greg Thelen , Konstantin Khlebnikov , Johannes Weiner , Michal Hocko , Cgroups , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Jan Kara , Dave Chinner , Jens Axboe , Christoph Hellwig , Li Zefan , Hugh Dickins Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 11, 2015 at 11:33 PM, Tejun Heo wrote: > Hello, Greg. > > On Wed, Feb 11, 2015 at 10:28:44AM -0800, Greg Thelen wrote: >> This seems good. I assume that blkcg writeback would query >> corresponding memcg for dirty page count to determine if over >> background limit. And balance_dirty_pages() would query memcg's dirty > > Yeah, available memory to the matching memcg and the number of dirty > pages in it. It's gonna work the same way as the global case just > scoped to the cgroup. That might be a problem: all dirty pages accounted to cgroup must be reachable for its own personal writeback or balanace-drity-pages will be unable to satisfy memcg dirty memory thresholds. I've done accounting for per-inode owner, but there is another option: shared inodes might be handled differently and will be available for all (or related) cgroup writebacks. Another side is that reclaimer now (mosly?) never trigger pageout. Memcg reclaimer should do something if it finds shared dirty page: either move it into right cgroup or make that inode reachable for memcg writeback. I've send patch which marks shared dirty inodes with flag I_DIRTY_SHARED or so. > >> page count to throttle based on blkcg's bandwidth. Note: memcg >> doesn't yet have dirty page counts, but several of us have made >> attempts at adding the counters. And it shouldn't be hard to get them >> merged. > > Can you please post those? > > So, cool, we're in agreement. Working on it. It shouldn't take too > long, hopefully. Good. As I see this design is almost equal to my proposal, maybe except that dumb first-owns-all-until-the-end rule. > > Thanks. > > -- > tejun > > -- > To unsubscribe, send a message with 'unsubscribe linux-mm' in > the body to majordomo@kvack.org. For more info on Linux MM, > see: http://www.linux-mm.org/ . > Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com [209.85.217.173]) by kanga.kvack.org (Postfix) with ESMTP id 062466B0032 for ; Wed, 11 Feb 2015 16:22:37 -0500 (EST) Received: by mail-lb0-f173.google.com with SMTP id n10so5855232lbv.4 for ; Wed, 11 Feb 2015 13:22:36 -0800 (PST) Received: from mail-lb0-x230.google.com (mail-lb0-x230.google.com. [2a00:1450:4010:c04::230]) by mx.google.com with ESMTPS id la5si1525000lac.113.2015.02.11.13.22.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Feb 2015 13:22:35 -0800 (PST) Received: by mail-lb0-f176.google.com with SMTP id u10so5818447lbd.7 for ; Wed, 11 Feb 2015 13:22:34 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20150211203359.GF21356@htj.duckdns.org> References: <20150205131514.GD25736@htj.dyndns.org> <20150205222522.GA10580@htj.dyndns.org> <20150206141746.GB10580@htj.dyndns.org> <20150207143839.GA9926@htj.dyndns.org> <20150211021906.GA21356@htj.duckdns.org> <20150211203359.GF21356@htj.duckdns.org> Date: Thu, 12 Feb 2015 00:22:34 +0300 Message-ID: Subject: Re: [RFC] Making memcg track ownership per address_space or anon_vma From: Konstantin Khlebnikov Content-Type: text/plain; charset=UTF-8 Sender: owner-linux-mm@kvack.org List-ID: To: Tejun Heo Cc: Greg Thelen , Konstantin Khlebnikov , Johannes Weiner , Michal Hocko , Cgroups , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Jan Kara , Dave Chinner , Jens Axboe , Christoph Hellwig , Li Zefan , Hugh Dickins On Wed, Feb 11, 2015 at 11:33 PM, Tejun Heo wrote: > Hello, Greg. > > On Wed, Feb 11, 2015 at 10:28:44AM -0800, Greg Thelen wrote: >> This seems good. I assume that blkcg writeback would query >> corresponding memcg for dirty page count to determine if over >> background limit. And balance_dirty_pages() would query memcg's dirty > > Yeah, available memory to the matching memcg and the number of dirty > pages in it. It's gonna work the same way as the global case just > scoped to the cgroup. That might be a problem: all dirty pages accounted to cgroup must be reachable for its own personal writeback or balanace-drity-pages will be unable to satisfy memcg dirty memory thresholds. I've done accounting for per-inode owner, but there is another option: shared inodes might be handled differently and will be available for all (or related) cgroup writebacks. Another side is that reclaimer now (mosly?) never trigger pageout. Memcg reclaimer should do something if it finds shared dirty page: either move it into right cgroup or make that inode reachable for memcg writeback. I've send patch which marks shared dirty inodes with flag I_DIRTY_SHARED or so. > >> page count to throttle based on blkcg's bandwidth. Note: memcg >> doesn't yet have dirty page counts, but several of us have made >> attempts at adding the counters. And it shouldn't be hard to get them >> merged. > > Can you please post those? > > So, cool, we're in agreement. Working on it. It shouldn't take too > long, hopefully. Good. As I see this design is almost equal to my proposal, maybe except that dumb first-owns-all-until-the-end rule. > > Thanks. > > -- > tejun > > -- > To unsubscribe, send a message with 'unsubscribe linux-mm' in > the body to majordomo@kvack.org. For more info on Linux MM, > see: http://www.linux-mm.org/ . > Don't email: email@kvack.org -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konstantin Khlebnikov Subject: Re: [RFC] Making memcg track ownership per address_space or anon_vma Date: Thu, 12 Feb 2015 00:22:34 +0300 Message-ID: References: <20150205131514.GD25736@htj.dyndns.org> <20150205222522.GA10580@htj.dyndns.org> <20150206141746.GB10580@htj.dyndns.org> <20150207143839.GA9926@htj.dyndns.org> <20150211021906.GA21356@htj.duckdns.org> <20150211203359.GF21356@htj.duckdns.org> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=6unf2wOFUIFUuhpxCOb7swm3j+egHgp0QYMbIKqdWnE=; b=UmZymxLIqMQzC8ZMdJT/0xZYcQ6gRM/HPiSookpJ62D8jOcQDKH/7XM3C8b+9bBMIG p9LLdghgUOedqJ9nGhRLnsxTxFUuGIh4lVK7WkW1ijCTrsT7eFKJeZwm3ioM3ACPRH4k 3FRXVLBAJ3bURX1VEeKS2gve+WovGVxNoKrNRs0VEQPO6D5ifo7D4RW3+UZYd/OPdeul IaP7fG8ZAjmoQfkv5GfevedYyzIEvNVVy7zJYTUO90DANr5gp8ACVCgKFImB9OI6EK55 4rdb+aECvrZYkUrIFlyH3md/y0syNTQZiocHEKErQKIYnCfO2cL58A4AieEV048Kw+Ka sR0Q== In-Reply-To: <20150211203359.GF21356-piEFEHQLUPpN0TnZuCh8vA@public.gmane.org> Sender: cgroups-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Tejun Heo Cc: Greg Thelen , Konstantin Khlebnikov , Johannes Weiner , Michal Hocko , Cgroups , "linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org" , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Jan Kara , Dave Chinner , Jens Axboe , Christoph Hellwig , Li Zefan , Hugh Dickins On Wed, Feb 11, 2015 at 11:33 PM, Tejun Heo wrote: > Hello, Greg. > > On Wed, Feb 11, 2015 at 10:28:44AM -0800, Greg Thelen wrote: >> This seems good. I assume that blkcg writeback would query >> corresponding memcg for dirty page count to determine if over >> background limit. And balance_dirty_pages() would query memcg's dirty > > Yeah, available memory to the matching memcg and the number of dirty > pages in it. It's gonna work the same way as the global case just > scoped to the cgroup. That might be a problem: all dirty pages accounted to cgroup must be reachable for its own personal writeback or balanace-drity-pages will be unable to satisfy memcg dirty memory thresholds. I've done accounting for per-inode owner, but there is another option: shared inodes might be handled differently and will be available for all (or related) cgroup writebacks. Another side is that reclaimer now (mosly?) never trigger pageout. Memcg reclaimer should do something if it finds shared dirty page: either move it into right cgroup or make that inode reachable for memcg writeback. I've send patch which marks shared dirty inodes with flag I_DIRTY_SHARED or so. > >> page count to throttle based on blkcg's bandwidth. Note: memcg >> doesn't yet have dirty page counts, but several of us have made >> attempts at adding the counters. And it shouldn't be hard to get them >> merged. > > Can you please post those? > > So, cool, we're in agreement. Working on it. It shouldn't take too > long, hopefully. Good. As I see this design is almost equal to my proposal, maybe except that dumb first-owns-all-until-the-end rule. > > Thanks. > > -- > tejun > > -- > To unsubscribe, send a message with 'unsubscribe linux-mm' in > the body to majordomo-Bw31MaZKKs0EbZ0PF+XxCw@public.gmane.org For more info on Linux MM, > see: http://www.linux-mm.org/ . > Don't email: email-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org