Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp116914lqp; Wed, 20 Mar 2024 15:49:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW1M8TLfbc+8xiulv/ZLZyYMB2ezjJ05+1S1kxf9+67xneyftCHWwcy9Mx3oDBHs1RuwtX+z4MWxz3rRGU0bHI2rNgtpymmbQ9hu9fP3w== X-Google-Smtp-Source: AGHT+IHYPOmc8POjokygrIerZKmaBOsHNF1m5/qYM3Dep2uAiafgd4HhV2ZQ+yuDH+q4p0JGWCSi X-Received: by 2002:a05:6870:d1c5:b0:219:23ed:8c5f with SMTP id b5-20020a056870d1c500b0021923ed8c5fmr7688395oac.54.1710974941051; Wed, 20 Mar 2024 15:49:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710974941; cv=pass; d=google.com; s=arc-20160816; b=QklybeBbOE6dzmKLdLOO1NArDuba5Mhp3cDEoeSKvKdeFucj2EkcB4pFyPngOglhso hshj+znEb6UsucOumzjq6WaCbWw8vVRczl6EoWPWzDy10ZVu4q822vEGxCp1VqQfQ+pM XSNnIzYASxbKiaE3TbPjDudApxmM0Gyt3cKKWtfTQV6PrIawhar7v8PXR83cxS8CtSsm 8JYomCXPB49BdFD3LBtZaHcYou3VCYQ71hQztSz/uSsIkif4DMp7bHuemzAprmwheq9U lXlsCzxV03uEyKdbVDhMn7EQ6T5YZYj7w5903Jb/OiGV5VUg93v/4y3l8fpVIjOgGao7 4xsg== 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:dkim-signature:date; bh=fdASLFv2/fpQ2J/Ny9c7D56INI9+Df/mhIjRVwm3hrg=; fh=q90i1v1IRxp38Lwi1NwmIP/iRfr3uyJGVJA4f5Ku03E=; b=AEFznvoQQpRymRIWFQvIzRN8260GBIbytNuAEamhlMWF4UhjgH5O4LBO6sSR8Yki7s V6bNajXAtn+14oixpntE1q99AcrjBozDohP4NgWsNhbT/PNRElm8gzMxO1YvLUmu/5Wy 4/CamAwB/m2DE1sR0GNqpnb9i1wHfQeRd9e+49d9t53lcjqPlKYkz6MdwMCnwsShHWut hof61vqNTAf3yta5aaskMbvGqqNxcBGE8rozY7+JhGAO5UiTET2VqFUkatyh0ZTxzosY 2/vA5jMGTI8m0C/AQipJX8okg36PGQCmtrz0g1WK2ubC0ozzrwWTeUeTCXvJaVnYefUT 0Crg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=URTtPPLS; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-109469-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109469-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id t16-20020a639550000000b005cee0fe93aesi13512618pgn.472.2024.03.20.15.49.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 15:49:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-109469-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=URTtPPLS; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-109469-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109469-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id DE401B25768 for ; Wed, 20 Mar 2024 22:40:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3574B126F2C; Wed, 20 Mar 2024 22:38:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="URTtPPLS" Received: from out-189.mta0.migadu.com (out-189.mta0.migadu.com [91.218.175.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 948D786AC5 for ; Wed, 20 Mar 2024 22:38:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710974329; cv=none; b=ZmtlbwFjJNqEtwonlsSi7ks805TLkqIouufBACk3pkaoYcHlpgMIKsCahhTBT9HbXaopuGq1cLinqT07gZ59hR/yLWyYYHEtOt9pI2ClaE4H0jknwmN/RwF07OTOsPE3VSYtc3I4me/sPZmHf5c/YZDtfvWBCGoHn3GsDAtKCMU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710974329; c=relaxed/simple; bh=zN7xwFByqtX0SNgUDblzv18pthRpp6ItWXcAvRRTgtA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uu8taR/ucSIl9BDYzYdJrpYxD4cCqHlV3FPZFCUYC5vGhGtDQ4mYEm4htq3se3L0rnZUqNa1sYo3BEuGzzd64OwYqg1pP4+SiXHtyr29FrcIcdTro/8T30TtrHj5F4rjbW/ySZcA5Pd7Xyy3BAUyPOBukFA9jymXb/rqr8kpAyg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=URTtPPLS; arc=none smtp.client-ip=91.218.175.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Wed, 20 Mar 2024 15:38:40 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1710974325; h=from:from:reply-to:subject:subject: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=fdASLFv2/fpQ2J/Ny9c7D56INI9+Df/mhIjRVwm3hrg=; b=URTtPPLSThfeQKeOGopVvqEwoBcfCWf55w/sMysnz0BWAaIWc23oX13AwEypZm92Jhv6U8 RdRh2Y3lNzCR09xWufVKFdcBEH3AR2XAw+qwB91xNKpyCftCanX6cXA9QSqE64r5yO9Is4 87gi9/lRigNTzlOM14FGLeK/GBcvZB0= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Pavel Tikhomirov Cc: Michal Hocko , Johannes Weiner , 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: X-Migadu-Flow: FLOW_OUT On Wed, Mar 20, 2024 at 06:55:05PM +0800, Pavel Tikhomirov wrote: > > > On 20/03/2024 18:28, Michal Hocko wrote: > > On Wed 20-03-24 18:03:30, 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. > > > > I would argue that uncoordinated hard limit configuration can cause > > problems on their own. > > Sorry, didn't know that. > > > Beside how is this any different from changing > > the high limit while we are inside the reclaim loop? > > I believe reclaim loop rereads limits on each iteration, e.g. in > reclaim_high(), so it should always be enforcing the right limit. > > > > > > We also have exactly the same thing in memory_high_write(). > > > > > > So let's stop enforcing old limits if we already have a new ones. > > > > I do see any reasons why this would be harmful I just do not see why > > this is a real thing or why the new behavior is any better for racing > > updaters as those are not deterministic anyway. If you have any actual > > usecase then more details would really help to justify this change. > > > > The existing behavior makes some sense as it enforces the given limit > > deterministically. > > I don't have any actual problem, usecase or reproduce at hand, I only see a > potential problem: If the problem is only potential and also not very severe (it's not a crash or memory corruption or something like this), I'd say let's keep things as they are. Thanks!