Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1662862lqt; Wed, 20 Mar 2024 10:13:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVKhVxUEjLwZKFZlfAVVfYC2HGJze5dDds6daqatUraBxCXFEYPEPYA6KEQxOfWMK7jEQrLve6aECj2WiK1HvjiHGaEmbUNs2QS1D/a+Q== X-Google-Smtp-Source: AGHT+IGlr3OLApgmIOy2lk9KPA1uYjse8un4tFHCiMAUx7WObK2yk3cdIjJe9oUZnEXppA80FCdD X-Received: by 2002:ac8:5843:0:b0:430:c601:5a31 with SMTP id h3-20020ac85843000000b00430c6015a31mr11531283qth.39.1710954787403; Wed, 20 Mar 2024 10:13:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710954787; cv=pass; d=google.com; s=arc-20160816; b=bjlxA5m+auIP38nPGVAk6Hb8bAY258BmRtdkZtvAnMfSVLSJxseCj1WgVQUf7eCX3g KDxE63qHgZg2ZDbafsKsbZQbcwI9vSa4k8P7bm+i8UBBmhdNbLXVeDE/x3pXEJhJoQzG dlsjKuzMhQNwauP2/M1tJBmFSXeZ4C+ZVr3lZLIxAK6UHYBhEeOJ9fqjZ1WX40TwkD/q 3cDZnUZA7rlkBb0PbclaQS4KEVo7V+6YAba7oS3LlJBrWYUbDA/XRx+UWg3Zxex47kTJ FyaDoxhcFuGrXNqggPa4POmdpUUsI9tyJH0TrEowxQRzg8+czZ1EG0dfiZIKtWUMvhUd j5sg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=YKC29gVMHa68RPkUNE5y3QIPIaFgwQ0ogCdZiW99o4Y=; fh=gtwHBQQSGXdVqKZKjA8R9b3QbDhmPciy+55IjIvkmYQ=; b=wbnCzEuNdcokzed9jISSb2nxFWA6ZXIbdv2mIy6z5jSoe+jj+J+5z3h6H7qX7KEh91 W/8dFafTgEF17QfcNFsvoOWtp0JgQsKjKhiZ3oNtjP3iJ8DqwgGTCi4FZZTv6C5e3hgA CLSBOFIe4/MGsF1rhwXh0gwfIhfGx/tGxRJAYuV/gtiSTv9mr3Z/MSvYAJTeCwkVzR7I k2ZDvRBy2VAmxPqBa40LDM9ZNxzf4L3WVFpkMAvGaW3DduIcrBkNNVIlL8vlKsfpXxc/ BmO0V/iQkYH/UUzaguFXBQYiOsrzDoVFXStcDKFMS8C+ai9dxU8J3OqG2pmP7hLB/puf jYCA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=fFVnI46b; dkim=pass header.i=@suse.com header.s=susede1 header.b=fFVnI46b; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-109212-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109212-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id b11-20020a05622a020b00b00430cad99fa6si7418909qtx.773.2024.03.20.10.13.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 10:13:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-109212-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=fFVnI46b; dkim=pass header.i=@suse.com header.s=susede1 header.b=fFVnI46b; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-109212-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109212-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5B70F1C2314D for ; Wed, 20 Mar 2024 17:13:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A01C76A024; Wed, 20 Mar 2024 17:12:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="fFVnI46b"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="fFVnI46b" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1178769DEE; Wed, 20 Mar 2024 17:12:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710954778; cv=none; b=Wcc8Cx8qRVLPQD84EmjCDthC48DLrAsleBE2vMsafaA54E3iuCf/gV7H8sotIW9ySl0T92nb2FK5TdynechBTG3yDEfQowfCGvf1WVyL3Mxox4CiiNoSsWE9BNJe8vpbxEBVGINDWcsUsz23qI4IAI1f30I97rjqWM1Nfjh4G68= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710954778; c=relaxed/simple; bh=RJrXqMW+w+hi9QE80+m6W2e3jA+FozIDfWRkYXdcaG0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Nv6Em4xHl7hH8BqVlGHAX6l4JhxS1cmQImL1XzckT72TUxYbt3UepvnngjySGyUjl/vldOO99JwzbNEReH8Yp+np2DRvHaCV/JLVkU5S66YwfOWMuiJiBY96fCrY0Q0aHYeD2k6kBTVxWbkPxc5JPGxrZxERmY9fBG2D1EVw9Yo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=fFVnI46b; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=fFVnI46b; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 3C2593487A; Wed, 20 Mar 2024 17:12:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1710954775; 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=YKC29gVMHa68RPkUNE5y3QIPIaFgwQ0ogCdZiW99o4Y=; b=fFVnI46bwaaJqWv9CMJQomIukyzK4/LpqBmE6tCL2mr0RDqiBRrsbwr5XgtFnOPPbgo/BF DX107ymc805OPGH8HqiTwV9YLNmmHa/+WlPe08AvOKHbTtVgeGOQ61Mc5JJv/hyC2dBNBv VTF6dnQmp2Wjia5UD4c0u5AtXOZtIAw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1710954775; 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=YKC29gVMHa68RPkUNE5y3QIPIaFgwQ0ogCdZiW99o4Y=; b=fFVnI46bwaaJqWv9CMJQomIukyzK4/LpqBmE6tCL2mr0RDqiBRrsbwr5XgtFnOPPbgo/BF DX107ymc805OPGH8HqiTwV9YLNmmHa/+WlPe08AvOKHbTtVgeGOQ61Mc5JJv/hyC2dBNBv VTF6dnQmp2Wjia5UD4c0u5AtXOZtIAw= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 1B45A136CD; Wed, 20 Mar 2024 17:12:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id EghGBBcZ+2VLdwAAD6G6ig (envelope-from ); Wed, 20 Mar 2024 17:12:55 +0000 Date: Wed, 20 Mar 2024 18:12:50 +0100 From: Michal Hocko To: Waiman Long Cc: Pavel Tikhomirov , Johannes Weiner , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , Vladimir Davydov , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel@openvz.org Subject: Re: [PATCH] mm/memcontrol: stop resize loop if limit was changed again Message-ID: References: <20240320100556.463266-1-ptikhomirov@virtuozzo.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Authentication-Results: smtp-out1.suse.de; none X-Spam-Level: X-Spam-Score: 0.64 X-Spamd-Result: default: False [0.64 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-0.20)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; BAYES_HAM(-0.06)[61.08%]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_LONG(-1.00)[-1.000]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; RCPT_COUNT_TWELVE(0.00)[12]; FUZZY_BLOCKED(0.00)[rspamd.com]; MID_RHS_NOT_FQDN(0.50)[]; FREEMAIL_CC(0.00)[virtuozzo.com,cmpxchg.org,linux.dev,linux-foundation.org,gmail.com,vger.kernel.org,kvack.org,openvz.org]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[] X-Spam-Flag: NO On Wed 20-03-24 13:09:07, Waiman Long wrote: > > On 3/20/24 06:03, Pavel Tikhomirov wrote: > > In memory_max_write() we first set memcg->memory.max and only then > > try to enforce it in loop. What if while we are in loop someone else > > have changed memcg->memory.max but we are still trying to enforce > > the old value? I believe this can lead to nasty consequence like getting > > an oom on perfectly fine cgroup within it's limits or excess reclaim. > > Concurrent write to the same cgroup control file is not possible as the > underlying kernfs_open_file structure has a mutex that serialize access to > the file. This is good to know and I was not aware of that. Thanks! -- Michal Hocko SUSE Labs