Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2429437rdd; Fri, 12 Jan 2024 09:07:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IEq+80tmMCj4GBHhxCbBiie1aIMIXHyHZ9xEFe5NGPzOO3spMevfiHiroCuIF+pTWFBC8OA X-Received: by 2002:a05:622a:1049:b0:429:c9ce:285 with SMTP id f9-20020a05622a104900b00429c9ce0285mr1761176qte.22.1705079234236; Fri, 12 Jan 2024 09:07:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705079234; cv=none; d=google.com; s=arc-20160816; b=ACyhW7Hbn38neOTnsbtn7e24Mwv/1sC5HNZpFKYvvvardqGhsdnKbR4FC3a+bPFdgt uc4VLPu5UT278y/BbztgwJWBin4x1GMpFLfBJhov3Jjel1awAeC+1auKdaw4AMOE+CqU fWlGJc1zCsl66YePk/9vy2VT+EiwS+NcIW4Zg7JxlBonE66y3jHzMmZ+ZGlCN4ouPEP+ 09LJsLjSDpXkwbU9zYG+6YzxbC2b6OefU+QmieHyb5MQgHoG9IYsGgENNcwl8k4Oz5mS ETTslnHJ9zg4uZ/Nmy9t4bG+G6KhsVqJTHOM3BSGTe2azLnNTHQwSCDT2gZre6f6uX0A 5BIQ== ARC-Message-Signature: i=1; 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=J9TtdXtQR+ltHvURBV7RXOVWC44VVGVh8yNJ9YJwFIw=; fh=LwiIhIBmTXnMn7QbPJtHOWsli5a48vfllnRrkOk8tr4=; b=BwXEp6w0o/7qrwN/Wh226K28JygG4nWsvay0h8UusrmxzfYwWG5lBZmnv5mi76Fv1S 3WhDgvFLeTSfCoCPZKpMk5EU/dZNS4UM+ffEqj2GUmkjYb5qP6zRcVzVLju+Om+6tBT9 K12mgQ7e82srJqq4NPQGf/X7FiMhdvxjB32/nvAm7gnVcCQxkPNx48R7+FZOKuR+TueV A1SUtRmHkOcLyJ4MIRpnmywOd3uqsaLd5WPfUhz/z9/7N9Emq0pCyWsflr/TW447IH7c eZJLiKSGx30hNAgAAIaqhL0SzmYCjqENunuDqonUZWG5w9UcBZjemzjIj1E0PncfUcZM Oxxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=CzJmzX9u; dkim=pass header.i=@suse.com header.s=susede1 header.b=CzJmzX9u; spf=pass (google.com: domain of linux-kernel+bounces-24887-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24887-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id e6-20020ac85986000000b00429c4813550si3420210qte.345.2024.01.12.09.07.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 09:07:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-24887-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=CzJmzX9u; dkim=pass header.i=@suse.com header.s=susede1 header.b=CzJmzX9u; spf=pass (google.com: domain of linux-kernel+bounces-24887-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24887-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 04AFE1C219AF for ; Fri, 12 Jan 2024 17:07:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C662017BDD; Fri, 12 Jan 2024 17:06:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="CzJmzX9u"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="CzJmzX9u" Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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 2B1311B5A5; Fri, 12 Jan 2024 17:06:41 +0000 (UTC) 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-out2.suse.de (Postfix) with ESMTPS id 242151F396; Fri, 12 Jan 2024 17:06:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1705079200; 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=J9TtdXtQR+ltHvURBV7RXOVWC44VVGVh8yNJ9YJwFIw=; b=CzJmzX9u/E6mMsRugcI6NK+0u8PnDPix0v9Q/Rj9A8iPbOT0dNbc6jqgkpKGS4zmknQo6Y nIqjvMm6yUu7OqvNEShPQ9pXBdcSSFJug7d5GEvNFQ38jwbAZZn+TEs+VcHT4RSYo93MS1 eTper5Sk6OKwn1MnaARO0/lLWHv0xW0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1705079200; 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=J9TtdXtQR+ltHvURBV7RXOVWC44VVGVh8yNJ9YJwFIw=; b=CzJmzX9u/E6mMsRugcI6NK+0u8PnDPix0v9Q/Rj9A8iPbOT0dNbc6jqgkpKGS4zmknQo6Y nIqjvMm6yUu7OqvNEShPQ9pXBdcSSFJug7d5GEvNFQ38jwbAZZn+TEs+VcHT4RSYo93MS1 eTper5Sk6OKwn1MnaARO0/lLWHv0xW0= 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 EB05013782; Fri, 12 Jan 2024 17:06:39 +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 f6NVNp9xoWUGNAAAD6G6ig (envelope-from ); Fri, 12 Jan 2024 17:06:39 +0000 Date: Fri, 12 Jan 2024 18:06:39 +0100 From: Michal Hocko To: Johannes Weiner Cc: Roman Gushchin , Andrew Morton , Shakeel Butt , Muchun Song , Tejun Heo , Dan Schatzberg , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: memcontrol: don't throttle dying tasks on memory.high Message-ID: References: <20240111132902.389862-1-hannes@cmpxchg.org> <20240111192807.GA424308@cmpxchg.org> 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: <20240111192807.GA424308@cmpxchg.org> Authentication-Results: smtp-out2.suse.de; none X-Spam-Level: X-Spam-Score: -0.29 X-Spamd-Result: default: False [-0.29 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; BAYES_HAM(-0.99)[87.09%]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(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]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-0.20)[-1.000]; RCPT_COUNT_SEVEN(0.00)[10]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_NOT_FQDN(0.50)[]; FREEMAIL_CC(0.00)[linux.dev,linux-foundation.org,google.com,kernel.org,gmail.com,vger.kernel.org,kvack.org]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[] X-Spam-Flag: NO On Thu 11-01-24 14:28:07, Johannes Weiner wrote: [...] > @@ -2867,11 +2882,17 @@ static int try_charge_memcg(struct mem_cgroup *memcg, gfp_t gfp_mask, > } > } while ((memcg = parent_mem_cgroup(memcg))); > > + /* > + * Reclaim is set up above to be called from the userland > + * return path. But also attempt synchronous reclaim to avoid > + * excessive overrun while the task is still inside the > + * kernel. If this is successful, the return path will see it > + * when it rechecks the overage and simply bail out. > + */ > if (current->memcg_nr_pages_over_high > MEMCG_CHARGE_BATCH && > !(current->flags & PF_MEMALLOC) && > - gfpflags_allow_blocking(gfp_mask)) { > + gfpflags_allow_blocking(gfp_mask)) > mem_cgroup_handle_over_high(gfp_mask); Have you lost the check for the dying task here? Other than that looks good to me. -- Michal Hocko SUSE Labs