Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp399520rwb; Thu, 18 Aug 2022 06:01:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR4xw6WbAuydbWVdAIGxCAKULcNeg9ohTv1QKo6rN4lzpyhmuviASUgjKVfboJ7SUgzEoDpW X-Received: by 2002:a17:90a:86c8:b0:1f4:fdc8:5055 with SMTP id y8-20020a17090a86c800b001f4fdc85055mr3035963pjv.239.1660827670129; Thu, 18 Aug 2022 06:01:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660827670; cv=none; d=google.com; s=arc-20160816; b=Fz++Vkpmg8R+YLHn0xklO+MN8yZwp0iMJYxFq9Tulhni7hork2aA9hSugEfMyAcVf8 Y9n5K5Ji/jnQms9lJMFsaR2gYpyfIazXE/Sam9k7vooSZxfmS/XuSeQrDj+YgjrErubN 29mmSYlvnKY/ETszvCag9oTgC567/Fy3FIYmJM8g+/At1xfXP+BfVQQXV9P59H67LDGf DYhniFHfRYhgRcKadDqTQ9aSJm1+HaK4Ytov3YWZ0lSYWEklKz5poCFstYndIPcOxabU q133hMLx7WBoGIYw2BRcJP21SlWI1ydeKN8ALqkNOTELw6UupQdYSLkTSJf55cnfBIAx Ugcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=eDIQKOW+lbVS7W8q+AYtm12149pDgcrZMmjTMK5FBv8=; b=bD30xGZG6vEXfWlGrhS0Y/sLV1oDfHI+n/RCqDrvL4g9GIZp7P3YHGNW/9JXDfowyM MgOMNucCFvAKwRxYxW8kZtaIUJ2Up73tKsNOWFYxLYiAemsLmEoz9NoKHKSZID8fzsSf NyGXzA4WMb4PAmeP5yhx+KjsGlQpUBrz6DNCgqpCAgeUMpCLduSwvtjKkrF54FSYnP6b 1Q4HuyRsi01c/HVM69aNBv9yI7c8NKyDDFYHx0uvsovlzrwaBd9HAVjxISVJSI1ZFyl4 TnpeJ3XhvtF0xVD7GvFVde2defBBHjfUQVQV+ny5MpGV0luSWXNTtVH3bYbzETJD+kAx Iwng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=XrYzmPIu; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e9-20020a170903240900b001713df0c8b2si1142550plo.213.2022.08.18.06.00.57; Thu, 18 Aug 2022 06:01:10 -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=@suse.com header.s=susede1 header.b=XrYzmPIu; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244644AbiHRM1s (ORCPT + 99 others); Thu, 18 Aug 2022 08:27:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244240AbiHRM1q (ORCPT ); Thu, 18 Aug 2022 08:27:46 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F12CC57245 for ; Thu, 18 Aug 2022 05:27:45 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A05075BEFF; Thu, 18 Aug 2022 12:27:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1660825664; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=eDIQKOW+lbVS7W8q+AYtm12149pDgcrZMmjTMK5FBv8=; b=XrYzmPIuXS5u/gAsg5febHUBkqX+vjRZ9y8Gm9X1g5OcdfQJ/rW8yoJhGgvKRYoPmmnsDm TQHEp8zxVKnujWfrFbILo3iBwAo6ycMMgW4iCtto49vAxDF7tzIXeTAl9EaI3ieA6yGg+4 TZxY1bPIy5tXMpPTTfOykwdnbBzgD84= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5FEE7133B5; Thu, 18 Aug 2022 12:27:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id OKJhFkAw/mLiRAAAMHmgww (envelope-from ); Thu, 18 Aug 2022 12:27:44 +0000 Date: Thu, 18 Aug 2022 14:27:43 +0200 From: Michal =?iso-8859-1?Q?Koutn=FD?= To: Vasily Averin 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 Subject: Re: [RFC PATCH] memcg: adjust memcg used to charge for new simple_xattrs objects Message-ID: <20220818122743.GB19175@blackbody.suse.cz> References: <62188f37-f816-08e9-cdd5-8df23131746d@openvz.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 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.) > 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. Thanks, Michal