Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3292263rwa; Tue, 23 Aug 2022 02:07:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR4NVBQNgnp/kvDa4sg4WjMRDIRRUN5gfEHndpYQDScVhPgOSi0iU8stQywNi94yLhZoGjVa X-Received: by 2002:a05:6402:2384:b0:446:4c2d:6530 with SMTP id j4-20020a056402238400b004464c2d6530mr2848398eda.401.1661245660377; Tue, 23 Aug 2022 02:07:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661245660; cv=none; d=google.com; s=arc-20160816; b=IUrvJHm+5LTPb0XzL5+0XSq9w3bUjJbJTTpZ+wNvDnYEKpnYXTTAP9xDWwNFVOZ9Ya rHzF+9piDAoVmM8qL84FF2eoW7WMi+r/SMEUpOBLgWa8xagAceD2pnWW7uQVE4edRNts wFVKwihWG2C2ARYg/FqZH40uOo/9f8P7ZT9Tn2A8dfSAXQWBcbabHDO41EFi2wiPxKT9 XGzr5Bx5sPRuR2Kh7+Eeg7piY5UsQ2jx8RbN1RCH6l2Viatc72tFlUl/UIiLxAGaGGXo a+cgxO3ILSid3GpTTMHcJ2xFXtNuqYFNJ0nyilrrv0XfeREtEMXaZ0f7c7bjp0AJg3f+ kEzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=dsUb3JwxKrpGEtwaM0xXt8nmsJshMrpryqMcaqMUxgw=; b=N0ViyZ1amnLTbySDq+8qyX1XbDZdny00knrXYdR2F+ER96YoghefAiRGmFuF1wZFqE 3uTLtbfPImuwi669GfMyC81pO+hRjdt5QtLMOccXZcyXvqPnE8PX+abdUdDDCfFJCibc 4o5fj8cZm6XqXZ+20q0b5nSvsyrqgFfKBkgdS0KOT63FedOu2uH0loWZ3Qs1+30eVlsr Wbcy8+oxdW2a8wJlcDXilguGJcl5wA1arVDFqApJz97hBlVT3R7NfLIu9tOdUHXHgS60 wF2HOK9tNhPclmkSeTBBkJhzke0515ZNTavQcqy1FLOf/UVd++iAPQbkkPigWycXI+Kd gtdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=HVGb4rTv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=openvz.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f25-20020a50d559000000b0043fab5ec76asi1606470edj.414.2022.08.23.02.07.13; Tue, 23 Aug 2022 02:07:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=HVGb4rTv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=openvz.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242043AbiHWIhy (ORCPT + 99 others); Tue, 23 Aug 2022 04:37:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346182AbiHWIgA (ORCPT ); Tue, 23 Aug 2022 04:36:00 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF891760FE for ; Tue, 23 Aug 2022 01:17:05 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id l19so9645874ljg.8 for ; Tue, 23 Aug 2022 01:17:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc; bh=dsUb3JwxKrpGEtwaM0xXt8nmsJshMrpryqMcaqMUxgw=; b=HVGb4rTve0Fn0XJnLuQnerqws3m5Uhfk3U25WThW/5EA2sh13xN47kcg6Kb0M0oDOd 9uV1jUMBYfese4AM4viw6rZp9A7dtiq+5cYAc8rkGxkcuECk2C04awFUvG7TcWNfpl5H vYBBxcx8pcmw7RkgdzctvGuCdMGJeyTT23ZCaJ9m/iA4/MLiL8J4ohtX7iQByuNsULCg GlTdQYgiScAhgclk132QhLpCCJJnI+2bWqFQSjPTVBQgIS9UxJ+6JEMIQdLw/yrlUMt5 LfRW+2FL9L/3LbTujvlPjCxbQ7t6VvdDZ5YDayNVICak4OiAHEewMAL7QAkAlcINZiw2 /h8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=dsUb3JwxKrpGEtwaM0xXt8nmsJshMrpryqMcaqMUxgw=; b=uIahdYlrnIB/Fp2Vb61nWf9qihr3jpisKCGEalFZFFziS90oSsdb10Zpv2bTqlae+b L75kYsZLc5pS3cPFttXNGoGhi0IZITHl0nLyyrJ5jdoUPrjs/WQUKIBmZQBzQbHCtURr zDopL+5H9XQvKz8HdWtW6f1g3HNCrqR+AuVNhI+Mg3gmIsoj0zotBUVbDOWH4Ei/5Kg4 HLqNrPERRtmAtOYy7Z+ML8h9Uy8TUH8wiUAYcTXQSjteiCi9YgInQNqQHQ+DYyFkSkN/ uYlyjg+776tEs3KY7/1rj/oweWPsGvx/8ogNM5VcOXx74BDx08dkX4qz0bQbVDmDGVkx uSzg== X-Gm-Message-State: ACgBeo0uuOvlaDGHt4yLwdk+++E9/4gtNDgHFqlKgcBZXS4yGwaMuQlJ RyzUP/8oOjlSDbCq6vp3FRO+0g== X-Received: by 2002:a2e:a7d6:0:b0:261:caab:a952 with SMTP id x22-20020a2ea7d6000000b00261caaba952mr2985133ljp.425.1661242622922; Tue, 23 Aug 2022 01:17:02 -0700 (PDT) Received: from [192.168.1.65] ([46.188.121.143]) by smtp.gmail.com with ESMTPSA id s10-20020a056512314a00b00492e36cb723sm1057328lfi.179.2022.08.23.01.17.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Aug 2022 01:17:02 -0700 (PDT) Message-ID: Date: Tue, 23 Aug 2022 11:17:01 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [RFC PATCH] memcg: adjust memcg used to charge for new simple_xattrs objects Content-Language: en-US To: =?UTF-8?Q?Michal_Koutn=c3=bd?= Cc: Roman Gushchin , tj@kernel.org, gregkh@linuxfoundation.org, hannes@cmpxchg.org, kernel@openvz.org, linux-kernel@vger.kernel.org, mhocko@suse.com, shakeelb@google.com, songmuchun@bytedance.com, viro@zeniv.linux.org.uk, Christian Brauner References: <62188f37-f816-08e9-cdd5-8df23131746d@openvz.org> <20220818122743.GB19175@blackbody.suse.cz> From: Vasily Averin In-Reply-To: <20220818122743.GB19175@blackbody.suse.cz> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 8/18/22 15:27, Michal Koutný wrote: > On Thu, Aug 18, 2022 at 12:10:45PM +0300, Vasily Averin wrote: >> sys_set[f]xattr uses simple_xattr infrastructure to create a new >> extended attribute for in-memory file systems like sysfs and tmpfs. >> Number and size of allocated objects are controlled by user space, >> they are always living in memory and its lifetime is indefinitely long. >> Therefore this memory should be properly accounted. >> >> By default new memory is accounted to memcg of creator process. > > despite objects aren't bound to this process lifetime. > > (I think this was the main argument for this approach and should be in > the commit message then.) Thank you for the remark, I'll update patch description in the next version >> As a result, neighboring xattrs of the same inode can be charged to >> different memcgs. This looks unexpected and makes hard the >> investigation of the memcg accounting issues. >> >> This patch adjust memcg used for such allocations. For kernfs >> it gives memcg from kernfs node, for shmem -- from shmem_info. >> This allows to cahrge all inode-sepcific objects to the same >> memory cgroup. > > IIUC you intend to inherit association from shmem_inode_info (i.e. > whoever created the inode). shmem_inode_cachep has SLAB_ACCOUNT, so it's valid. Yes, you are right, I'll clarify this in next patch version. Thank you, Vasily Averin