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 F396FE784BB for ; Mon, 2 Oct 2023 15:08:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 580378D0025; Mon, 2 Oct 2023 11:08:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 51D5E8D000E; Mon, 2 Oct 2023 11:08:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D2278D0025; Mon, 2 Oct 2023 11:08:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 2D01A8D000E for ; Mon, 2 Oct 2023 11:08:41 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E67DA802F6 for ; Mon, 2 Oct 2023 15:08:40 +0000 (UTC) X-FDA: 81300853200.30.2A97946 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf09.hostedemail.com (Postfix) with ESMTP id E1DDD14000D for ; Mon, 2 Oct 2023 15:08:37 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=JJVJWppz; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf09.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696259318; 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=v7RkAWT8P/BhIWfEv3U2TDwSRWzSpgBkJQFDvWrSmgw=; b=7zpwv5n48T6x7rfsW9jKNreMO6sFv3uha+hhrojt+NpxTPzlkzjPlkgO9D3482K/yarMLI SoPo4/STK9BpYqR6fKqdv0GvKrzb9RcCabeKot4fKuyYRqh9DllSJDGfePHeYIfZMMkeTU sY3bLtB1bEeBs0sq/oblsuH8BYkkgCo= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=JJVJWppz; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf09.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696259318; a=rsa-sha256; cv=none; b=5uIxDBwmZolvhFB1jYHkModbpoT6uSPwOFl1PcHe4KtlamFtbjDKNMU4CyZJGBrtL4/ftb qSOYDzhdt/epDbFXVvOthYwHa0tk2a4VXuG+iy2mUdUy/6YBSn/ZrgnYaIT0bocl1hUg3z +eT0hpf5MiReP6EE8ozLhw/3MdqhT+0= 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 D5D711F37C; Mon, 2 Oct 2023 15:08:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1696259315; 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=v7RkAWT8P/BhIWfEv3U2TDwSRWzSpgBkJQFDvWrSmgw=; b=JJVJWppzCEiSTgO8xYZqOIry+2FEtIwD/wtmru7N7p86BngBpEM4UNLSd2XD8uja/GoAQo yr5rxXJHdI1IhcPf7hgaiOJZ/w0TaIUZPWZr70+mbioFU9knq8ry97Pto0rc9TzlnA9Ygg xKoTWsicQ5lfu5yVRf2EqvUypKPbOQ4= 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 B191A13434; Mon, 2 Oct 2023 15:08:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id n7E1KPPcGmXGeQAAMHmgww (envelope-from ); Mon, 02 Oct 2023 15:08:35 +0000 Date: Mon, 2 Oct 2023 17:08:34 +0200 From: Michal Hocko To: Johannes Weiner Cc: Nhat Pham , akpm@linux-foundation.org, riel@surriel.com, roman.gushchin@linux.dev, shakeelb@google.com, muchun.song@linux.dev, tj@kernel.org, lizefan.x@bytedance.com, shuah@kernel.org, mike.kravetz@oracle.com, yosryahmed@google.com, linux-mm@kvack.org, kernel-team@meta.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Subject: Re: [PATCH v2 1/2] hugetlb: memcg: account hugetlb-backed memory in memory controller Message-ID: References: <20230928005723.1709119-1-nphamcs@gmail.com> <20230928005723.1709119-2-nphamcs@gmail.com> <20231002145026.GB4414@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231002145026.GB4414@cmpxchg.org> X-Rspamd-Queue-Id: E1DDD14000D X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: qxweig8mwa7ricjfm7reszhf5xs7e3ct X-HE-Tag: 1696259317-819504 X-HE-Meta: U2FsdGVkX1/QPOB69hIftrSVPwdV36uFEbRddkl7465QDvfE2P5d7f576CW7O1Dw9LW4hTdytT52iv3UZvJYWkH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, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon 02-10-23 10:50:26, Johannes Weiner wrote: > On Mon, Oct 02, 2023 at 03:43:19PM +0200, Michal Hocko wrote: > > On Wed 27-09-23 17:57:22, Nhat Pham wrote: [...] > > - memcg limit reclaim doesn't assist hugetlb pages allocation when > > hugetlb overcommit is configured (i.e. pages are not consumed from the > > pool) which means that the page allocation might disrupt workloads > > from other memcgs. > > - failure to charge a hugetlb page results in SIGBUS rather > > than memcg oom killer. That could be the case even if the > > hugetlb pool still has pages available and there is > > reclaimable memory in the memcg. > > Are these actually true? AFAICS, regardless of whether the page comes > from the pool or the buddy allocator, the memcg code will go through > the regular charge path, attempt reclaim, and OOM if that fails. OK, I should have been more explicit. Let me expand. Charges are accounted only _after_ the actual allocation is done. So the actual allocation is not constrained by the memcg context. It might reclaim from the memcg at that time but the disruption could have already happened. Not really any different from regular memory allocation attempt but much more visible with GB pages and one could reasonably expect that memcg should stop such a GB allocation if the local reclaim would be hopeless to free up enough from its own consumption. Makes more sense? With the later point I meant to say that the memcg OOM killer will not communicate the hugetlb request failure so the usual SIGBUS will be returned to the userspace. I can imagine a SIGBUS handler could check hugetlb availability to retry or something similar. -- Michal Hocko SUSE Labs