Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1590420rdb; Mon, 2 Oct 2023 14:38:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF3AjGQV8redea5RAA11Z4PUqj4FsEytnPnFhpKc9Q92wIZkjmhdNXa02nl23zxhENtadJV X-Received: by 2002:a17:902:c942:b0:1c7:4ab6:b3cc with SMTP id i2-20020a170902c94200b001c74ab6b3ccmr10792512pla.54.1696282720541; Mon, 02 Oct 2023 14:38:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696282720; cv=none; d=google.com; s=arc-20160816; b=MD2VE76ObzcfG4uUAKIw3tfgXZTlcKQOGSooQBngtJO5jpBvdxDZg0lDXbfvHRYJfx uWNpfAPOOOGyBImvwe52mlIMOeZqVd21CjlBTxIqfPHlzQLoaBNFmI2nIclYoxG1mjsx 9OwnMzAURpr3fY7lDr5e94Rt7lxkIDdZinQ53Q2qIGWqLsZ86t7YmmH7HndWwXDdSOlS gQBFLKGrPc+gDMxDKhV6JZoMR+mgR/spnUV6xfa8iC/3/o4vaSMFZyPfTFxHMxrgoix6 zd6OjZOlMISTTe8hFQ3BSzc9hDDArID7lLyroZO8L91qTMzq7mb2TtVtERVYuMxRhzzZ G9Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=v7RkAWT8P/BhIWfEv3U2TDwSRWzSpgBkJQFDvWrSmgw=; fh=fjt4lcjRSxYlDAkP9tHo8uYQsEMLbNk8aWb7udEiLqA=; b=yLHJEeLNLhYO9vfDzcnUKNib8WN9/QBKI7UWaRPAIDtAXf22z/dBQsha26B5uksXHb iAJdHrRyBNCc+4Lw5RGk3Mta4Vayv09aiTG4X+k2sFp7KFynUgz+A19iemDzuqdmbgoi 0vwbmiSEaXujDB9Ipztrx0JjWn0LUm78KNqMOmMjh3OGMT9PezWdND1YKVGKIPOWsEZw RvzPzQ1xM7bSm9igg524CSR3R8AIP6c4TEcbpX2Cp+QFkb0BTF62m5EvBVY7V5nI1Tgq KPQLdHU3nU5tM7Z0+EXZ7R9MkdPrqQ80GhgYwTJCOpUZH9AnpctE2unk7u7ww9T1XAQo p2zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=JJVJWppz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id lg5-20020a170902fb8500b001b8b4371af8si25128184plb.648.2023.10.02.14.38.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 14:38:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=JJVJWppz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id D28018070652; Mon, 2 Oct 2023 08:08:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237885AbjJBPIm (ORCPT + 99 others); Mon, 2 Oct 2023 11:08:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236077AbjJBPIk (ORCPT ); Mon, 2 Oct 2023 11:08:40 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5361BB7; Mon, 2 Oct 2023 08:08:37 -0700 (PDT) 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 02 Oct 2023 08:08:49 -0700 (PDT) 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