From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24B8BC433EF for ; Thu, 23 Jun 2022 08:06:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A83D18E013C; Thu, 23 Jun 2022 04:06:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A34518E0115; Thu, 23 Jun 2022 04:06:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8FCF78E013C; Thu, 23 Jun 2022 04:06:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 817978E0115 for ; Thu, 23 Jun 2022 04:06:00 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 53F983581E for ; Thu, 23 Jun 2022 08:06:00 +0000 (UTC) X-FDA: 79608767280.07.CF4A918 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf03.hostedemail.com (Postfix) with ESMTP id 8FE5E200AD for ; Thu, 23 Jun 2022 08:05:59 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id B06011FD3B; Thu, 23 Jun 2022 08:05:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1655971557; 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=y9JvyrtgVzfCy9ltHeRGduIrfv2kgcjya7gqZ8Tg/Eg=; b=NyVtGuJt8cxNsPfYFDoV+sIvK1KTL8xU6r6mwnAYB2JKqguCEJ9f/3TqAsImvAR01eR767 q/fw2eL8mU8xVld1PKOtc+bBWtYdBf2xpd/9Pmk20D0RpEweflTKcZjNKqraXVi4sWplQi PO+js2nqOqm2w+GNEKhlXlL7F+vzvlQ= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 50F6B2C142; Thu, 23 Jun 2022 08:05:51 +0000 (UTC) Date: Thu, 23 Jun 2022 10:05:56 +0200 From: Michal Hocko To: Yosry Ahmed Cc: Johannes Weiner , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , Matthew Wilcox , Vlastimil Babka , David Hildenbrand , Miaohe Lin , NeilBrown , Alistair Popple , Suren Baghdasaryan , Peter Xu , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH] mm: vmpressure: don't count userspace-induced reclaim as memory pressure Message-ID: References: <20220623000530.1194226-1-yosryahmed@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220623000530.1194226-1-yosryahmed@google.com> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655971559; a=rsa-sha256; cv=none; b=UNQdKZrkMd7ByrhtxXJ+pC3XL6ARavxM48JAl0QuLiBeiq64gEuJa+lgMjoafI7R5j8w6r QGC58Qa+ROe3VIowcF/m+sdbDGcIQXQxjRxNGcNSNBNNiea3AX2yZ4L5OBhzGCKKuCGwVz OJp1SAJrXBj1M2twRYSlUb2wJtERRRA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655971559; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=y9JvyrtgVzfCy9ltHeRGduIrfv2kgcjya7gqZ8Tg/Eg=; b=EJiafrVFtnaxOKIFATBp8zf9FlmpXOyi2elyInWMl6lSIDkZCsCQFBg/hG52gyjDB1SFkj VfTlKKuP5jWlI/1B0zBngR8OeqVRjrUI2fEe9HF/oRMraL5sW9pOe1tunoIgEh1NferGgy sK9MYlSkiPYBbShhmCcn17nK+PoKNnc= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=NyVtGuJt; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf03.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com X-Rspam-User: X-Rspamd-Queue-Id: 8FE5E200AD Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=NyVtGuJt; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf03.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com X-Stat-Signature: pndyyam8stpxaq9xwo1uaoerben9sq59 X-Rspamd-Server: rspam09 X-HE-Tag: 1655971559-23586 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu 23-06-22 00:05:30, Yosry Ahmed wrote: > Commit e22c6ed90aa9 ("mm: memcontrol: don't count limit-setting reclaim > as memory pressure") made sure that memory reclaim that is induced by > userspace (limit-setting, proactive reclaim, ..) is not counted as > memory pressure for the purposes of psi. > > Instead of counting psi inside try_to_free_mem_cgroup_pages(), callers > from try_charge() and reclaim_high() wrap the call to > try_to_free_mem_cgroup_pages() with psi handlers. > > However, vmpressure is still counted in these cases where reclaim is > directly induced by userspace. This patch makes sure vmpressure is not > counted in those operations, in the same way as psi. Since vmpressure > calls need to happen deeper within the reclaim path, the same approach > could not be followed. Hence, a new "controlled" flag is added to struct > scan_control to flag a reclaim operation that is controlled by > userspace. This flag is set by limit-setting and proactive reclaim > operations, and is used to count vmpressure correctly. > > To prevent future divergence of psi and vmpressure, commit e22c6ed90aa9 > ("mm: memcontrol: don't count limit-setting reclaim as memory pressure") > is effectively reverted and the same flag is used to control psi as > well. Why do we need to add this is a legacy interface now? Are there any pre-existing users who realized this is bugging them? Please be more specific about the usecase. -- Michal Hocko SUSE Labs