Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4186368ybz; Mon, 20 Apr 2020 17:45:50 -0700 (PDT) X-Google-Smtp-Source: APiQypLTBY/lYBYiY3v1FCByKH50kTPhRSWqAtemCX1aSJgQj8E9Lvn7TS8gGxm4Iai2r6w8gJU8 X-Received: by 2002:a50:8c01:: with SMTP id p1mr16997489edp.4.1587429949792; Mon, 20 Apr 2020 17:45:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587429949; cv=none; d=google.com; s=arc-20160816; b=QjefFNFkXVxNV8cAfyLRlNnQL0PKrKDdrXMwmygU53WiX24pUadUe1GGHDnNbOakOq PNMp4nWIxF0/QAqQ24leYSJ0/sxp8IRJ+cf3+a3nyoXSRUGulehfjoo3/NqDIKpAZ/zd 2yT9XZ0HtR/lIvxO8+OjCRCo2C6nEFJPHbhno0ETUpXuGcnc37M+C9Hi7odsstmcigk+ NNN2y+O6qIwCNo4f6Zr46HCJ2uehQoXXidUVoZ23P/pArKMt4lX4/43ZA0fiwI2aPDLU sXNe22vTZNiYk29a9VyeIAV9vOtOfCYVIo+83aay0lzEqMK3Qv+MNfgMezOWqsNqOazk awjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=YZRwrK1UjiJpxDYSszjRPtqs1cjLjLji6Aam7rS81wo=; b=Ln57VS1v99wECP0KL3oxEBmRn+zdyHzX+T75/IwT8LxYee72BVAbv/5DFBhi6qUmk8 P1VQ43ejEhOv5M40wYfgeVzp8DFEqddy4+vT74qaYLGIFrtBSwI8gBwQ6gVVuYWWl96H GCU+nBAmhnaVaLNJynFyXFl/hIlvHK7JpRSUaLm+gmJBTuzAWTJJ3a3ce1sfS1gG6qsX 9Mnf0J2pbEKmMH0K3yAXdl3HHwWTSchoxHsr/S/ci4kAUmJCk5CQIQp10D5tPm2fR/NH BhUdZQ5HzpgnvPVNmBVQeYZTdB7gzBfLcHc6MGlyEAPpfOE1fwpregKqZR5UpEMXR+vf /mBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=FQPGxAaF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g26si533323ejr.99.2020.04.20.17.45.27; Mon, 20 Apr 2020 17:45:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=FQPGxAaF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726850AbgDUAoD (ORCPT + 99 others); Mon, 20 Apr 2020 20:44:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726405AbgDUAoB (ORCPT ); Mon, 20 Apr 2020 20:44:01 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26415C061A10 for ; Mon, 20 Apr 2020 17:44:00 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id w145so9663523lff.3 for ; Mon, 20 Apr 2020 17:44:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YZRwrK1UjiJpxDYSszjRPtqs1cjLjLji6Aam7rS81wo=; b=FQPGxAaF17vSSjjng+SYnVVTyYVA5s2NG2nnA/4N5kDp/WGCIrb9f25On61fC0A+Mz ArASZ/MOC2sFxS+nTQb0i3heZ8Ll8zNSL8IdvP2+Mna+8oUk343fzXUGUxuQLgoMW1Z4 O1jPs/t5whKhm7gTkJBQZestxtL3Dmcfy7EBMApLi0iSO0KWfQQuLCxKrEFiTYNN/OWU h0Ilp90Q6OjyQ3npdWPqddwv5b8E9qdaHGsEOkd8UvwVHnCIO9+AnxuUgJmr+wM8tDXz 7krNt+EMRR4FeeU9CTQQ/Ufy7Dc5u+ind2EDMZ2YSGF7sRuDCng69DxqD8wNP25ug6Nz Ql8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YZRwrK1UjiJpxDYSszjRPtqs1cjLjLji6Aam7rS81wo=; b=VBsQiytJHCsWR6tVLTmRX8al0hEnxQVxQW/DECbFPhFq/H61Y+9Vs5KN79nebygfMN 41k1/kyJ7CLPqF3HUi3lBTEkHtB0/6DNBRRFPR7pcD4HFO2aSFvqjzwPaMlaawFyzjPp 9hfHfN3P9YplX6TbAxWVk/jG6Zyvf7HrXRUs1sLBYgJji+o4sy2ApMYsqBO+D3F4O5AN 1VaN/5L3pgmrU5kqiW8WyXS/eLY1nHOx1lDnISGilGf+kba3JWFGOwedTk8Xw6xk+V/e A4QsMukMFiMTT6NLDBL//aw6xaCRa2+8YzxaSQ5WEowPd9HCARS5CYSHikALRQz8CqhB 8ddQ== X-Gm-Message-State: AGi0PuYjwWTFV0nS77X49F2uVFBLdRVepeidpWFquyFc02RG+RvCj8WB /FnfWco/ybaXrVcP/zYnv7KZ0Q+sIAE2nw+CGkWlMg== X-Received: by 2002:a05:6512:318a:: with SMTP id i10mr12195933lfe.96.1587429838243; Mon, 20 Apr 2020 17:43:58 -0700 (PDT) MIME-Version: 1.0 References: <20200420223936.6773-1-schatzberg.dan@gmail.com> <20200420223936.6773-3-schatzberg.dan@gmail.com> In-Reply-To: <20200420223936.6773-3-schatzberg.dan@gmail.com> From: Shakeel Butt Date: Mon, 20 Apr 2020 17:43:47 -0700 Message-ID: Subject: Re: [PATCH 2/4] mm: support nesting memalloc_use_memcg() To: Dan Schatzberg Cc: Jens Axboe , Alexander Viro , Jan Kara , Amir Goldstein , Tejun Heo , Li Zefan , Johannes Weiner , Michal Hocko , Vladimir Davydov , Andrew Morton , Hugh Dickins , Roman Gushchin , Chris Down , Yang Shi , Ingo Molnar , "Peter Zijlstra (Intel)" , Mathieu Desnoyers , "Kirill A. Shutemov" , Andrea Arcangeli , Thomas Gleixner , "open list:BLOCK LAYER" , open list , "open list:FILESYSTEMS (VFS and infrastructure)" , "open list:CONTROL GROUP (CGROUP)" , "open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 20, 2020 at 3:41 PM Dan Schatzberg wrote: > > The memalloc_use_memcg() function to override the default memcg > accounting context currently doesn't nest. But the patches to make the > loop driver cgroup-aware will end up nesting: > > [ 98.137605] alloc_page_buffers+0x210/0x288 > [ 98.141799] __getblk_gfp+0x1d4/0x400 > [ 98.145475] ext4_read_block_bitmap_nowait+0x148/0xbc8 > [ 98.150628] ext4_mb_init_cache+0x25c/0x9b0 > [ 98.154821] ext4_mb_init_group+0x270/0x390 > [ 98.159014] ext4_mb_good_group+0x264/0x270 > [ 98.163208] ext4_mb_regular_allocator+0x480/0x798 > [ 98.168011] ext4_mb_new_blocks+0x958/0x10f8 > [ 98.172294] ext4_ext_map_blocks+0xec8/0x1618 > [ 98.176660] ext4_map_blocks+0x1b8/0x8a0 > [ 98.180592] ext4_writepages+0x830/0xf10 > [ 98.184523] do_writepages+0xb4/0x198 > [ 98.188195] __filemap_fdatawrite_range+0x170/0x1c8 > [ 98.193086] filemap_write_and_wait_range+0x40/0xb0 > [ 98.197974] ext4_punch_hole+0x4a4/0x660 > [ 98.201907] ext4_fallocate+0x294/0x1190 > [ 98.205839] loop_process_work+0x690/0x1100 > [ 98.210032] loop_workfn+0x2c/0x110 > [ 98.213529] process_one_work+0x3e0/0x648 > [ 98.217546] worker_thread+0x70/0x670 > [ 98.221217] kthread+0x1b8/0x1c0 > [ 98.224452] ret_from_fork+0x10/0x18 > > where loop_process_work() sets the memcg override to the memcg that > submitted the IO request, and alloc_page_buffers() sets the override > to the memcg that instantiated the cache page, which may differ. > > Make memalloc_use_memcg() return the old memcg and convert existing > users to a stacking model. Delete the unused memalloc_unuse_memcg(). > > Signed-off-by: Dan Schatzberg This patch was from Johannes, so I would suggest to keep his authorship and signoff along with your signoff. Reviewed-by: Shakeel Butt