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 4CCB8C4332F for ; Thu, 9 Nov 2023 06:37:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DB70C6B0337; Thu, 9 Nov 2023 01:37:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D67D06B0338; Thu, 9 Nov 2023 01:37:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C2E586B0339; Thu, 9 Nov 2023 01:37:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id B43766B0337 for ; Thu, 9 Nov 2023 01:37:16 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7CDA680DB1 for ; Thu, 9 Nov 2023 06:37:16 +0000 (UTC) X-FDA: 81437458872.07.8BBC9BF Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by imf21.hostedemail.com (Postfix) with ESMTP id B81F81C000D for ; Thu, 9 Nov 2023 06:37:13 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=kFf5vDcJ; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf21.hostedemail.com: domain of shakeelb@google.com designates 209.85.214.179 as permitted sender) smtp.mailfrom=shakeelb@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1699511833; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=uxlrRZY9oH7YHuU4myXTI016nFwsBkve7ko66/h6F4c=; b=ySnqWzD5oSmM3dr/TAYurfx9m3QSycxqyMwJR1qpp06DIx7Hx+QJtNRkc0yvDlO9/f8RiH AAdXEdNo9J0th+L8be536EazHUpGLe6hd6NtnhqjQq5An3AchTbZTuhBnjNs9zfj+bqLL7 oSk9DdbPBdVfBWcCttvpKgL1so5XN3k= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=kFf5vDcJ; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf21.hostedemail.com: domain of shakeelb@google.com designates 209.85.214.179 as permitted sender) smtp.mailfrom=shakeelb@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1699511833; a=rsa-sha256; cv=none; b=VizZYFfOuWZE4IdDOwB9HhkRLWeLj+Y5+JDqTFs+WBXVssCJYUpWwoGpykuvy49CVcjLXL g5P/Zq1s8OAOtSaxFm4v2IOX2kUkfTT5Yk6WUF41V0VyQuJ+0DE13kXb38E5R9M51oz3sr 52O1cN18qGny8uQYK5vX+fxPSHlJrTM= Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1cc209561c3so118615ad.0 for ; Wed, 08 Nov 2023 22:37:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1699511832; x=1700116632; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=uxlrRZY9oH7YHuU4myXTI016nFwsBkve7ko66/h6F4c=; b=kFf5vDcJ9UnMtdp2yWMVDG1OU2nHi/Hgkn5gEjiN3rVi9KagBGvvX90kQnWKDSlY/f o7G1rig19S/wHncckT5g8R5dJXpydgoNOR0n7hz0AWutcRWTaPRGizWuJbvY22qzL+NE uxbXQUJxh63tbSUjEsI6Cm/Esdldeim/5vUFZOcZw/3EONnf9mlnw/wSVDAq7+HFrLnP narmM6RCuvG555r5o+kjx6vvEdb5LknpZgnO1dubM7TscrYV5DgDBGXSO8WyKD2ySx0L c5yCYhSYRxWCAy3z0yj9nDrMoLqfI/ZjtXmx6YegojAj7/4y3EfmkF4JQH2eBeHBV0Ul Qjyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699511832; x=1700116632; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uxlrRZY9oH7YHuU4myXTI016nFwsBkve7ko66/h6F4c=; b=hQ65U8qUR53PH3TdXoT4GQIoatL4bZnN0zGO++UJzdDPYeB7Nr7gLHUpJl5TBSbewM EJmyW0QmlBa+Bsbg4mtKH0E+bbioyV63Qe5qWAK2WSXkKuiim8pCCm1N6oSopo7RXkm9 EwolWSUZwpSNWDnEIWVYJf0p2bndc93vE2aj1JEMWtXNhcdQX8MJLuUZnEEfUSuwYtIv cnj16TlASmb/+fFQcegLaE94aFvv+dFh9nN70iQK4mxF/xl46irgd6T/GcbJmZr8URHz CGMNDoltHLUQeSyZOokcM6StBbLsZMK7SaDTJYWon9qk1u3SqygVM89UIk1bBIl79L/h hiXA== X-Gm-Message-State: AOJu0Yxi6hibrqW9g77KYIU5bH8xODJMHotAn9H6NqRN7x0biuVTYMnx IkbPXEo6DnVPDg5NRzsBtaCIzKf1jO3/Dqw5F+IVqQ== X-Google-Smtp-Source: AGHT+IGGYvUujjdjMkJajUdyu44vBZUqjUps1Ija86z4tiQSb6gKgfA25DLHsrWcPvImiBqHroYNmzmTf5CnUUtxbEE= X-Received: by 2002:a17:902:c146:b0:1cc:4624:48e with SMTP id 6-20020a170902c14600b001cc4624048emr162419plj.24.1699511832355; Wed, 08 Nov 2023 22:37:12 -0800 (PST) MIME-Version: 1.0 References: <6b42243e-f197-600a-5d22-56bd728a5ad8@gentwo.org> <8f6d3d89-3632-01a8-80b8-6a788a4ba7a8@linux.com> In-Reply-To: From: Shakeel Butt Date: Wed, 8 Nov 2023 22:37:00 -0800 Message-ID: Subject: Re: cgroups: warning for metadata allocation with GFP_NOFAIL (was Re: folio_alloc_buffers() doing allocations > order 1 with GFP_NOFAIL) To: Michal Hocko Cc: Roman Gushchin , Christoph Lameter , Matthew Wilcox , linux-mm@kvack.org, cgroups@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: B81F81C000D X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: pz91q7s7zyr7aumbg4jzpa39mj4rrz9e X-HE-Tag: 1699511833-45001 X-HE-Meta: U2FsdGVkX19EZ5tRw29bhbNuKGL2exwHLD+EQMu03sBfHs8ReFNfM14NVBbwX8IXCR4EG4pP7SWE6/ZVZkx3d6/ijvVxdGSAJp96mJFryBslAn2BMETYe5pFWf37MllCdn+wmNn5pI8iSS4siHPjVI93eRDkdo+Jh9j8aWoxK2TBC+gK3Z7uO2+wIobVLHUi1ibteiPevSbdMnDQaaa5cb6NBw8eDidZ12nyQ/E7ofP79DFzBsxgPg4q1wBLiEvgfKhVbENk1qH3OH3cBP9FfcCdp/7CBUHeGdrsaQAg48uP7BKYszEMq35CCYvk9w/FpYEBZnuXa8SP842Ag7pxqF5QIDsjce3tAqEXAcyOs1nA/ID0ibgQ1K3eqxmBEHPET8VBmsM01nl8E1/P7erENCmwkdVZhUNO9PcIbvXuKgySLVPfHAyaETPyr1YDQkTxLEM3FvNwDZSvphIGgCVF+WsiC4fR2kX5bG1Nl7KvZpCCOOKTGIJFFLsEXQWWG0/CVWJrdAf50qmXBaAH3AlJpUZjSDWXOQGE0Fps1Bx39YGe8PwKCDPbZx+Lg58zJORfyrl20+88LHXW9JoInhgFqCuH3370pZCSUkFupb16ySRIW4VdZJIc6TlXmTnOm3d9NxJvZmQB2p0aLQJUOrdiEHxmqr/Lvul4iuXE3UiC3w3MDrMHh/zn6VRzxZaC02+l0ek5UAGE/7ycux3OvRvc8wDcVnk3qdCbkDH3mYSE7R07m7zpjWmBSse2zJEhaW9Rpj3nbVBvcdw7NLc5Lxc3JNclNY+0NAVu8vi1jyN3lcnWn1fIpJcKZhGGUSgdkfwS0EdjVLOHWI4vM33HHF12Kn/l6mTC8sJZQEx6cnkK3wU9P5trxIkD9Gzeh6ZHpYj06enhL3QEzZAyM1Q4ORXd4WPZkn3I5Y7QT9lD+MdQR6bAZuytCJ2GNOx9Pcjs3nhrZ8oKf7kkbKzLlpGKXV9 fDsrX4Qw k1/OSpTyA6lhS4FXBvuUSfrW4ru0MlM6cAy9/jPh2E/Yn3+vgsh6WNkzAvxub7kwAXKdwUWhTUCcKXL9v1f9SKMKhce+85GgrVg5D4d7SNcxYh6X6OcCqrsBxaznK5nh/4bZaOI4MPvGz5u9k5Wzw3AhqOs8xM/9W4s2x4B1d0OJiliqIQgtooj26/1DRcmuj7/OjPL5Qx1x/tYoRAm3zBtfny3dJ7SCtCdb9t+rpuVuZB5dQvT1QC0qDZJBxrGfJyP1jnylY2w/ycWAukarkNG/02VRh0MvRP+3EnhRQtyfSL2MfiVP83f6hl6eLHPGOWIuauxI2yBx5iGU= 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: List-Subscribe: List-Unsubscribe: On Wed, Nov 8, 2023 at 2:33=E2=80=AFAM Michal Hocko wrote= : > > On Tue 07-11-23 10:05:24, Roman Gushchin wrote: > > On Mon, Nov 06, 2023 at 06:57:05PM -0800, Christoph Lameter wrote: > > > Right.. Well lets add the cgoup folks to this. > > > > Hello! > > > > I think it's the best thing we can do now. Thoughts? > > > > >From 5ed3e88f4f052b6ce8dbec0545dfc80eb7534a1a Mon Sep 17 00:00:00 2001 > > From: Roman Gushchin > > Date: Tue, 7 Nov 2023 09:18:02 -0800 > > Subject: [PATCH] mm: kmem: drop __GFP_NOFAIL when allocating objcg vect= ors > > > > Objcg vectors attached to slab pages to store slab object ownership > > information are allocated using gfp flags for the original slab > > allocation. Depending on slab page order and the size of slab objects, > > objcg vector can take several pages. > > > > If the original allocation was done with the __GFP_NOFAIL flag, it > > triggered a warning in the page allocation code. Indeed, order > 1 > > pages should not been allocated with the __GFP_NOFAIL flag. > > > > Fix this by simple dropping the __GFP_NOFAIL flag when allocating > > the objcg vector. It effectively allows to skip the accounting of a > > single slab object under a heavy memory pressure. > > It would be really good to describe what happens if the memcg metadata > allocation fails. AFAICS both callers of memcg_alloc_slab_cgroups - > memcg_slab_post_alloc_hook and account_slab will simply skip the > accounting which is rather curious but probably tolerable (does this > allow to runaway from memcg limits). If that is intended then it should > be documented so that new users do not get it wrong. We do not want to > error ever propagate down to the allocator caller which doesn't expect > it. The memcg metadata allocation failure is a situation kind of similar to how we used to have per-memcg kmem caches for accounting slab memory. The first allocation from a memcg triggers kmem cache creation and lets the allocation pass through. > > Btw. if the large allocation is really necessary, which hasn't been > explained so far AFAIK, would vmalloc fallback be an option? > For this specific scenario, large allocation is kind of unexpected, like a large (multi-order) slab having tiny objects. Roman, do you know the slab settings where this failure occurs? Anyways, I think kvmalloc is a better option. Most of the time we should have order 0 allocation here and for weird settings we fallback to vmalloc.