Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1047279imm; Wed, 15 Aug 2018 10:27:27 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwwBSZEsYd5bX2I9PYjCgGs3ebMR2q7bwIRYtni41mQ0fb885QRj+zTlvPK2CmO1Y/GJDEe X-Received: by 2002:a63:b02:: with SMTP id 2-v6mr25122256pgl.301.1534354047556; Wed, 15 Aug 2018 10:27:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534354047; cv=none; d=google.com; s=arc-20160816; b=qOymvX2y3mKKbofSJGykC2xG/h6/gUvYaQdsypQVqLV8bM5P2h1Z06itZK+JZHBTC1 duqgkV4EhMoZLtFnsJqS9H9ctc9T1QVbPtGNsG9a1mfMmPvrqHaNeMAMhLNaMXYrdOfo om4tiXot318XOQd8IZYnU2hEJpFX9XYPc+XcWYJeuu3rqDVjBZAdRUC8mk2XGHTeQjsU hFVNe8rwbZi6VECLE+ypP1TQD3hOYTn2xb35/0GehduuoLhcKKTzpPdJhMBn2gkE4UJA 028/MRqD3OL5aYbABXcir6VFOgmgTkYIex+KwpFLJVCcSuW/xgAjlPtLVLT/sWlcsDBS iNPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature:arc-authentication-results; bh=cmk9fz4b72B/EW7SSYzDGhKCVMWZtmeWkJvsx2BaEbk=; b=TzX3ZJpLDIjtQoLEvST22I5SvJ1iBroiGeFTI0fciklPBqH21llylaCUL7/9Rpn8Wv nLsH4zjZkP7KyW9yrny5Sp5Xq12O90HTidHzxjqDIsToTRtp+wvRtb1FDSWy805Y7Ks4 TGTgBKTDU1UGbuhhPCqacb8OFcFSs299Cb/+ByKXhdJqpw75C2OJDWVsSMWDmH2VNYKH CAgA3tnt1dR5F7+g3bpUmw09bCZnwPXIif0rMDpkbOtxULNwrXo19r/DJ9xJwEIxBsQp KBL05R6ssbEdV1IRfz3GnYEgmEEgGZj1teJXNb6YxtV01FMztHqw33IBmX5/bkEannCG FcCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b="OE/pP1K6"; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b="KvN8/kNC"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q30-v6si22963623pgk.253.2018.08.15.10.27.11; Wed, 15 Aug 2018 10:27:27 -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=@fb.com header.s=facebook header.b="OE/pP1K6"; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b="KvN8/kNC"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730005AbeHOUTU (ORCPT + 99 others); Wed, 15 Aug 2018 16:19:20 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:33138 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727604AbeHOUTU (ORCPT ); Wed, 15 Aug 2018 16:19:20 -0400 Received: from pps.filterd (m0044008.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w7FHO70i008878; Wed, 15 Aug 2018 10:26:12 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : content-transfer-encoding : in-reply-to; s=facebook; bh=cmk9fz4b72B/EW7SSYzDGhKCVMWZtmeWkJvsx2BaEbk=; b=OE/pP1K6udAkFGCTZ6lu9GKSmFr7OrOQAzrfJCCjAbzgc1YOznYmIMqpkm8yGy+X3Xvr N4Ekl0hs/iVKjJ2Aq+T1NnybbdkS36XV/7Gv7CzCxdCM17PjEu/x/qldCEVIKCdwMB7U lqtVYPsYv3zZciI3WRgpdjd98VraeupOSaM= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2kvp5w0h91-2 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 15 Aug 2018 10:26:12 -0700 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (192.168.54.28) by o365-in.thefacebook.com (192.168.16.13) with Microsoft SMTP Server (TLS) id 14.3.361.1; Wed, 15 Aug 2018 10:26:08 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cmk9fz4b72B/EW7SSYzDGhKCVMWZtmeWkJvsx2BaEbk=; b=KvN8/kNCpkgZuLvuDDuAgmv8zyWoa9BXuQtwh2YxoXpx56fItpZoeLzQsYdr+rT1jq5a+69Kfe46Du3ae2andvPme5/HlL0rP0JLGhQ5HN0s+0q5FtyCOPXTLYzTWJG5nVgt6BLkTFE6iNeLWeD7R+AS62E3lEgBvWMTuz73Lcw= Received: from castle.DHCP.thefacebook.com (2620:10d:c090:200::5:abf7) by BY2PR15MB0168.namprd15.prod.outlook.com (2a01:111:e400:58e0::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.25; Wed, 15 Aug 2018 17:26:03 +0000 Date: Wed, 15 Aug 2018 10:25:58 -0700 From: Roman Gushchin To: Andy Lutomirski CC: Johannes Weiner , , , , Michal Hocko , Andy Lutomirski , Konstantin Khlebnikov , Tejun Heo Subject: Re: [RFC PATCH 1/2] mm: rework memcg kernel stack accounting Message-ID: <20180815172557.GC26330@castle.DHCP.thefacebook.com> References: <20180815003620.15678-1-guro@fb.com> <20180815163923.GA28953@cmpxchg.org> <20180815165513.GA26330@castle.DHCP.thefacebook.com> <2393E780-2B97-4BEE-8374-8E9E5249E5AD@amacapital.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2393E780-2B97-4BEE-8374-8E9E5249E5AD@amacapital.net> User-Agent: Mutt/1.9.2 (2017-12-15) X-Originating-IP: [2620:10d:c090:200::5:abf7] X-ClientProxiedBy: MWHPR1701CA0024.namprd17.prod.outlook.com (2603:10b6:301:14::34) To BY2PR15MB0168.namprd15.prod.outlook.com (2a01:111:e400:58e0::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f6cbad61-aa1a-4916-c49d-08d602d42db0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:BY2PR15MB0168; X-Microsoft-Exchange-Diagnostics: 1;BY2PR15MB0168;3:Zcifp63Kd8+ptWWgF2xzr6A0RNXlxtgHBaygiT1nKw9zGf8lUikZ9rL+q8AqCesvmwgiY4yVyouUiwnVlWvNfrPHPt8c1EVMKhpUinJ166kvKZzrvcws1t1vMLUIyaiTUlT/IdQp8+VirD4Wiru5kFukgEfTnFvtmA2KqJcGWVx7ZHhjNdgWrkrZFPCYNnpz8/MhLQOhYsxEbKk1QYEVtED2obBS3p2VP/5StdF6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5EHtrr2fCgjRDWOrOfVjjSbCJErQS/njH6YtnVBtN8vvMLOKlhN2ox4wGk3Lh3ZfmRc4YKGrlE9p5E85b1nn5vNz86Teiy8Xe4i62NbVC8aPQTvEeXt;4:Yr0zHa/2UCVx85FOAOXe/TH4OwjTrU/WoF0aw9xcgng/NR24Qa1foFhNWaoANhbHp2AgwPkkg+EaxvLP9nI5GCcQSsiBLYoAzrmP4S2/j5Sx8vWvY9D9zLpEjAsb06gzDuKQh0MWUPNpvLBugmKgViNFq8wjOcgFNWS2rd2TlgIwGYbUe3qQJfCJA3HpIdWb27Gnyd+tq6UNKlohUXGLpaeA8JY74x8kH5s9QG92EIdWgy/2btcA67g2Azy5G3+8q+zmyGWC221GHs5JTyoeLeFD1r8DrhJz5sC/iHu05w/wDuAu5v8BN6cPx8sFwBRk X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231311)(11241501184)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123560045)(20161123564045)(6072148)(201708071742011)(7699016);SRVR:BY2PR15MB0168;BCL:0;PCL:0;RULEID:;SRVR:BY2PR15MB0168; X-Forefront-PRVS: 07658B8EA3 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(366004)(136003)(376002)(39860400002)(346002)(396003)(52314003)(199004)(189003)(4326008)(6506007)(33656002)(9686003)(53546011)(6116002)(1076002)(11346002)(476003)(8936002)(446003)(486006)(55016002)(50466002)(5660300001)(2486003)(105586002)(386003)(23676004)(52146003)(52396003)(46003)(16526019)(39060400002)(229853002)(186003)(7696005)(106356001)(6246003)(478600001)(53936002)(76176011)(52116002)(2906002)(2870700001)(93886005)(25786009)(15650500001)(97736004)(58126008)(54906003)(81156014)(47776003)(305945005)(316002)(7736002)(8676002)(86362001)(68736007)(6916009)(14444005)(217873002)(6666003)(81166006)(18370500001)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR15MB0168;H:castle.DHCP.thefacebook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCWTJQUjE1TUIwMTY4OzIzOlRaTXdsRDY4L01Ld3l2RFZ2YWRoZExoU01R?= =?utf-8?B?c0gxblJGVnBIS0FWcXNnQnVza3krNHlPN0pNUklpL1IrYTVucDVXaDdLRmVQ?= =?utf-8?B?cWxKSkpDRFBCWjVqeEh4cE1FNC9abk9WZzU2VVlqTTY0aUFKSzlhMU5DM01C?= =?utf-8?B?STF2UXh1ZGk3SkJ6TEpucm5wdE4xR0JwbUJIM0VwWEFBeFlGT2ZveUphdCsr?= =?utf-8?B?RS9JWVZNYkZqKzRDbGxqaFc1LzlMSVZIOVZ6ZE40YWlIZmNmcTZUNXBOYnhH?= =?utf-8?B?YlVOZFphMGthKzVKUVErK1hRbzhoTG5MREcvZHFsZUdXVzlkTDBhRE9rU3o3?= =?utf-8?B?UTZFM2tEcE9uVmRPb29Bd2pZQ1pRUmJMdUNWSStoK2ZEZUw1NXZ2SFM3Z2Ex?= =?utf-8?B?blhyVzkySDRBY0tiZXNqa21EM1MzTU1yRlBUeHgrQ0ViSXNTa3NwNi9OSnhz?= =?utf-8?B?Zm1kZlpNVFA1QnByOU8vZWU0SnZ4UmUyRDNOb0hyamhFQnFuVUJGSGExdjd4?= =?utf-8?B?SjVkb21KN1FudXZPbHlRbHcrRzhVbHhNOFAzTVY2bnFvSU5SS2VWRkRPNi95?= =?utf-8?B?dnVjWXdxT1Blbmd4eW5BVC9MUFNrNUtWUWl2bjU4Zm51TUk0RE1KaGRUNUhv?= =?utf-8?B?bHZOUWdq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SblGsAxI56dncktOXNSpRYvNaEbwnRXCC8kHpbY3PXEyISSMoHDF96aJ/Ggrw1lB0ejHIY6oQae0grjgmflQ67IBwCjtA4pomCzcle2my4Z6dxcjDPxCF131CEJ7U4uR0ypBvz5e4MgTJq8KSvlNFcbnzSUPc1Nfj4zsjEEftrI+Zs/wUvkE1hEd/b08+VyoXWQJq9etxzXJy9VlC7aBI/jqMT9sB8PyMxrs4aygaE56EpJQkdjeXW+upo+iEi5BN/3uBZWTK5viA9FSiuTgT343kY8PCi9xw==;5:2hJ3V74Edc8Xs9TYmXiosLqFuUu75sxLoeBkO4l/bCNsx0oWKTnvuFG9aJab9fApmWdY4/xf4lVcOvQOc1rAh2RreZPxevhHLo7cSfAVOFuw10mE/Crf5UTxLzJ5fIzd+IN2NJhbWNWOt0/tjLT49VPhdn1YI0H5SuBGrP30eDY=;7:tGwG9hQMAt9W/eVL2AIlJTf7lKyaEYGwMReMOPRtiEvWMIXb7OUxpWSer4IiB+USXWlbfvzGUgMpQBRTcltd04UvCQRKimMuXS/HmEB9jXQb/BX4SPhXL6XhRbUvMcSkGg6X0C9Ae3W0dzQSgG7NqhArzq5CnBpSee49zDevzhfGL37cavNa67W6QH9Ft7cyt2wzqoXx+Nv6vkDrgwZLdrn67kNnNoxoWcmhsQ4ElxmUZB/+kETvsY8Z8nM/quem SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BY2PR15MB0168;20:GzHuLR0MeW4eNuLEDEHdQrBdqhBu/ULenKoMnyNhBc6aylftfMtZVBuKX4EwrnwUU0MTL9LXIQXh73i4VAUMhiuHPwJYPjnIjbVRvx96D6CQ3i35FepAxG1MhSBzIg/qwVv7PvQmv776yWchpZOeRmRhpNTLpA9CBNY39UUvj1g= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2018 17:26:03.4238 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f6cbad61-aa1a-4916-c49d-08d602d42db0 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR15MB0168 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-08-15_06:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 15, 2018 at 10:12:42AM -0700, Andy Lutomirski wrote: > > > > On Aug 15, 2018, at 9:55 AM, Roman Gushchin wrote: > > > >> On Wed, Aug 15, 2018 at 12:39:23PM -0400, Johannes Weiner wrote: > >>> On Tue, Aug 14, 2018 at 05:36:19PM -0700, Roman Gushchin wrote: > >>> @@ -224,9 +224,14 @@ static unsigned long *alloc_thread_stack_node(struct task_struct *tsk, int node) > >>> return s->addr; > >>> } > >>> > >>> + /* > >>> + * Allocated stacks are cached and later reused by new threads, > >>> + * so memcg accounting is performed manually on assigning/releasing > >>> + * stacks to tasks. Drop __GFP_ACCOUNT. > >>> + */ > >>> stack = __vmalloc_node_range(THREAD_SIZE, THREAD_ALIGN, > >>> VMALLOC_START, VMALLOC_END, > >>> - THREADINFO_GFP, > >>> + THREADINFO_GFP & ~__GFP_ACCOUNT, > >>> PAGE_KERNEL, > >>> 0, node, __builtin_return_address(0)); > >>> > >>> @@ -246,12 +251,41 @@ static unsigned long *alloc_thread_stack_node(struct task_struct *tsk, int node) > >>> #endif > >>> } > >>> > >>> +static void memcg_charge_kernel_stack(struct task_struct *tsk) > >>> +{ > >>> +#ifdef CONFIG_VMAP_STACK > >>> + struct vm_struct *vm = task_stack_vm_area(tsk); > >>> + > >>> + if (vm) { > >>> + int i; > >>> + > >>> + for (i = 0; i < THREAD_SIZE / PAGE_SIZE; i++) > >>> + memcg_kmem_charge(vm->pages[i], __GFP_NOFAIL, > >>> + compound_order(vm->pages[i])); > >>> + > >>> + /* All stack pages belong to the same memcg. */ > >>> + mod_memcg_page_state(vm->pages[0], MEMCG_KERNEL_STACK_KB, > >>> + THREAD_SIZE / 1024); > >>> + } > >>> +#endif > >>> +} > >> > >> Before this change, the memory limit can fail the fork, but afterwards > >> fork() can grow memory consumption unimpeded by the cgroup settings. > >> > >> Can we continue to use try_charge() here and fail the fork? > > > > We can, but I'm not convinced we should. > > > > Kernel stack is relatively small, and it's already allocated at this point. > > So IMO exceeding the memcg limit for 1-2 pages isn't worse than > > adding complexity and handle this case (e.g. uncharge partially > > charged stack). Do you have an example, when it does matter? > > What bounds it to just a few pages? Couldn’t there be lots of forks in flight that all hit this path? It’s unlikely, and there are surely easier DoS vectors, but still. Because any following memcg-aware allocation will fail. There is also the pid cgroup controlled which can be used to limit the number of forks. Anyway, I'm ok to handle the this case and fail fork, if you think it does matter.