Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3271795lfo; Mon, 23 May 2022 00:24:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeZ7gFf4sgFQBeQJYCKIRdwx7VfBfsOtSg9Mjt242u5Mb3dziEkkJ5ClyE7nIlYD6dxVkb X-Received: by 2002:a63:f813:0:b0:3f6:475:6389 with SMTP id n19-20020a63f813000000b003f604756389mr19538541pgh.127.1653290665724; Mon, 23 May 2022 00:24:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653290665; cv=none; d=google.com; s=arc-20160816; b=QjZjq6hzehKwxWCml+DHJeX0/sARLp7SvxQhEyig7+UIpjMQ5iXG+7p5/IVy20K+AR wSXUe6WyfBoA4UOOX2AtScRZSfTNNrvm3qacMUe8fOcUs9IFIqYUHS/ZeHE0k8ESA70a mBWQBDW0t1APWYxv9VpNkPFmLgOIj6/RGs1Rh4e5bs6bFRUWGHOhkWyexLB0kB+cn0Q6 OfPFtLBLCv93m5AYOp4w2KDfZGVgKxS+/p5NIBwNxvREXUmiyBiOHQlQWedfoM5igNMM 4qWjY9AyEb+8/Kc8P2touz61efJmaA6OFJYpKIPNO1kG6xGTc1X15hWzWRbcTD5ifdx+ 57vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=v+86wYP36U311zaok342X50l9ECadNdMvxTZhZZ14tg=; b=WuR93yG+MTLeNHT/MrVDLS/smKwfmxcf1NAAWf2Lv1K6gnhH9E8bd3oMb1j+TAHwfB /fgAEVZ2JZec4ijB9AhVztqv4GubwX/hzTkBDkep6XNSv6O99p8Iqb+HDIl/0YYZ5cAX 8bFSrUWcB69L9iv6vSZep+jFDfNlnarkwNZdIC6Is1w/0JXwScvK89qOis+VRq8f5xU0 19GdyHItW91FcXb1UaP4lsmxB5T4SCh16jGNIx2BFJFbtWnAojn+nCuKgZG29eozzKI2 06NMyOZaoR4BkWGb/Q9CG6h7NXdqxyVgiOWwtxq4lwWqx4mnXI/eXoNztGgy+TafQsfr q4DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=2UtmFRcC; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id p19-20020a170902a41300b0015873958cc9si8471492plq.515.2022.05.23.00.24.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 00:24:25 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=2UtmFRcC; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 59C21C8BE7; Sun, 22 May 2022 23:38:39 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242203AbiEVGsX (ORCPT + 99 others); Sun, 22 May 2022 02:48:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239944AbiEVGsU (ORCPT ); Sun, 22 May 2022 02:48:20 -0400 Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 604343668D for ; Sat, 21 May 2022 23:48:19 -0700 (PDT) Received: by mail-yb1-xb2c.google.com with SMTP id p139so20359723ybc.11 for ; Sat, 21 May 2022 23:48:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=v+86wYP36U311zaok342X50l9ECadNdMvxTZhZZ14tg=; b=2UtmFRcCttqhVCYCxkvMGj1oc42Q+TyiCf7Rh2JlB+DFl9as9uUEP04r2Tx9KZzwMw YWV/0SVPIrdAzgtlxIJrFaVbtgMWlklBLxambHEJKDPlReq8UdjzGw9drwD6TMoVRO+V G54/gUVExox3CmE1K3kCF1KpEpk5ioGFI0a7ASDRM35NvxidOzMd4230U4oSfpZ0yP+T 9tbyFvrynWSP5oVmMaPsVvyuiRX5LsOgS1R53xUZvsa7JZo/GbuTq8yT44YuCxf0I8LU nX0KSUO+R0vfTSTblwBGQDCKkvV6ljOTr/wf/pLoT6nYKV5jR0DXNCg9O+TZ7a4MlAQ8 4XAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=v+86wYP36U311zaok342X50l9ECadNdMvxTZhZZ14tg=; b=bNKdZWG/oQOdJGE80XT9SaH67eEmWKR6hjNGok0qD4yKi2nB9QUYS1ZJmyzfflAhm9 /QFpwfs1sJbkQvjBvPUskQ4aRa687Sui04ZxaqqF4bfOdL/URaH8XjTeSsfLAAPYLR42 TWhew7lLoG7jVdnovw2Q/LM8fNWVTs+H2KayV7Hq59ZCJ19XBwYyNnbD50I6E7B4eXfX +qYuVUOdxluGsBCB7+eleNs+RbudMySmgVWeaw5zZKKw3d5kLpk8ZxGL3Bt28mC0Q95x 1fa2rwQK7BC3Y4/rFNUwnTPbtUKlDnZ3TtzZFeAJX8I23mVuwe403MtB97Hp/+Kcf62I 8nPg== X-Gm-Message-State: AOAM532nRLaPBiCYjpgx+9oFx71heql43Rji9jUfDoTcQQTs+4E0GgH5 1Pvq9uD1NFJlYade6/BZDU1ToldpotbFb9lbg8TmCevUUHLgiA== X-Received: by 2002:a25:6fd4:0:b0:649:a5f5:c6b2 with SMTP id k203-20020a256fd4000000b00649a5f5c6b2mr16641652ybc.132.1653202098638; Sat, 21 May 2022 23:48:18 -0700 (PDT) MIME-Version: 1.0 References: <9925d0ba-40d7-e3a8-1fef-054968b26ce6@openvz.org> In-Reply-To: <9925d0ba-40d7-e3a8-1fef-054968b26ce6@openvz.org> From: Muchun Song Date: Sun, 22 May 2022 14:47:42 +0800 Message-ID: Subject: Re: [PATCH mm v2 7/9] memcg: enable accounting for large allocations in mem_cgroup_css_alloc To: Vasily Averin Cc: Andrew Morton , kernel@openvz.org, LKML , Linux Memory Management List , Shakeel Butt , Roman Gushchin , =?UTF-8?Q?Michal_Koutn=C3=BD?= , Vlastimil Babka , Michal Hocko , Cgroups Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 22, 2022 at 12:38 AM Vasily Averin wrote: > > Creation of each memory cgroup allocates few huge objects in > mem_cgroup_css_alloc(). Its size exceeds the size of memory > accounted in common part of cgroup creation: > > common part: ~11Kb + 318 bytes percpu > memcg: ~17Kb + 4692 bytes percpu > > memory: > ------ > Allocs Alloc $1*$2 Sum Allocation > number size > -------------------------------------------- > 1 + 8192 8192 8192 (mem_cgroup_css_alloc+0x4a) 14 ~ 352 4928 13120 KERNFS > 1 + 2048 2048 15168 (mem_cgroup_css_alloc+0xdd) 1 1024 1024 16192 (alloc_shrinker_info+0x79) > 1 584 584 16776 (radix_tree_node_alloc.constprop.0+0x89) > 2 64 128 16904 (percpu_ref_init+0x6a) > 1 64 64 16968 (mem_cgroup_css_online+0x32) > > 1 = 3684 3684 3684 call_site=mem_cgroup_css_alloc+0x9e > 1 = 984 984 4668 call_site=mem_cgroup_css_alloc+0xfd > 2 12 24 4692 call_site=percpu_ref_init+0x23 > > '=' -- already accounted, > '+' -- to be accounted, > '~' -- partially accounted > > Accounting for this memory helps to avoid misuse inside memcg-limited > contianers. > > Signed-off-by: Vasily Averin Reviewed-by: Muchun Song