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 D7FD8C4345F for ; Mon, 29 Apr 2024 23:50:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 02EBC6B007B; Mon, 29 Apr 2024 19:50:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F20486B0083; Mon, 29 Apr 2024 19:50:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DE7D66B0085; Mon, 29 Apr 2024 19:50:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id C0F496B007B for ; Mon, 29 Apr 2024 19:50:01 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 43BAA140252 for ; Mon, 29 Apr 2024 23:50:01 +0000 (UTC) X-FDA: 82064215002.05.FCC47E1 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by imf03.hostedemail.com (Postfix) with ESMTP id 4C93920006 for ; Mon, 29 Apr 2024 23:49:59 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=fromorbit-com.20230601.gappssmtp.com header.s=20230601 header.b=Gp2eLgwL; spf=pass (imf03.hostedemail.com: domain of david@fromorbit.com designates 209.85.210.170 as permitted sender) smtp.mailfrom=david@fromorbit.com; dmarc=pass (policy=quarantine) header.from=fromorbit.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714434599; 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=DiddL8zAMvqY9VshCFjzx63U+GcMXjyvOVSjq0kNaIU=; b=PeDsoRm96PUFTXO46uPt8mf6gsZdxURR2f5fQWKDfUd9KFzMWxaOo57kdZLgyI1zMLN9HS hkLSnFOpEt+vSzjRxteEKwf3RrecSyocOmlYnS5quYHGMUov2CJRDTmN73A/xENzj124f7 tP5jR9EiL1dhR68HqKopimMtmb3bq1o= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=fromorbit-com.20230601.gappssmtp.com header.s=20230601 header.b=Gp2eLgwL; spf=pass (imf03.hostedemail.com: domain of david@fromorbit.com designates 209.85.210.170 as permitted sender) smtp.mailfrom=david@fromorbit.com; dmarc=pass (policy=quarantine) header.from=fromorbit.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714434599; a=rsa-sha256; cv=none; b=XqR+rziQlNXswWFiaouowDd66Jk4xAUi2nIrT7aAHXnCVqf1X4c8ovy+DptcYZv7oBWtH7 qO42EMD5D0cg+2q7iHC9tlP5XdzdeRhn+yrqzXYo+PvWE1FB//BFIQm3wdRvwD39hyXe8Z /KnloHLZY7O4m4S6lsGs2KhNfJCWwyA= Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-6ee0642f718so4589491b3a.0 for ; Mon, 29 Apr 2024 16:49:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fromorbit-com.20230601.gappssmtp.com; s=20230601; t=1714434598; x=1715039398; darn=kvack.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=DiddL8zAMvqY9VshCFjzx63U+GcMXjyvOVSjq0kNaIU=; b=Gp2eLgwLKCtXWpxoTphBUF9bBni6QUc/q3YttYo3qFA+yG0EsHRtxZNvY2aSVkuIGs 4UQzPmJnkHA4DjrWlGNab5SY1x6HWOF41Ou9Qkz3v9EBjQCZnKfpf1dlwLDYTbhhu1s0 n0nzpMcfJ9JEtwgHGG2rS2QemLqXjtqOMhev7vMN+uPubcJaatITHKiOHj1RB6ZDJEiJ y6mh8/KN5HwbYMpRDRDKuhS4o/j+WHmskioKQeMXuaNEH9AZ2wDFv1MYDuY5QV4g134j wqcyBGYlB40sKlRNnL0HRh4n5OXc39RVCk+yFLW3VVimc1xk8t2DGX52jzLJlVKFNMO1 slMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714434598; x=1715039398; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=DiddL8zAMvqY9VshCFjzx63U+GcMXjyvOVSjq0kNaIU=; b=n6Ctx1ttl5BdJEaLJOhgICn0XBnNZHHVOifdOpc6ejSRB+iC6OlynbTCfSGrrr/vKN NjdWUC9bEX/xmYhbIbaG/CNVbxOBtvOg2L+QfmbN5qbuDFPHdZ8r41TZnbqnPQbOWX0U bG7yvnhtK7TdcXFGClcpRsQjJM+4B067cDRi5KERVlBPh89RKF46yWQjmESIVU/v03ho Eni1Il2YwYa2xGgDjIqHGZHNUTPIh8fd5tWGPfZECDj2UykAqkorIR/YO+EWrW2+3mb8 mFhTkNS2s5KY5w+RMXM+LpomWbdsatDdQ6HCHRCIlFSU+E/YsEraNxREbTXxqYhDgbP8 oqwA== X-Forwarded-Encrypted: i=1; AJvYcCXj5XodTBZOgN4hSq/z55aqhpq/V/lCEKRrIQrfOxMsUZCObL2U7jE8LOmJF7UF7WbYLnihPo9S8btI6kBi/rCSsGI= X-Gm-Message-State: AOJu0YyhimLJ5rUDq48+Z5Tx7R76LabLdtWMCnAj2qh/HJT0eaGlqPuJ 2BIyW/88Ye3BqLmTeyQFnRIHfZPhEgNCkHn5q8PfOLUrhrYcxIR9RtkmIAAxeF8= X-Google-Smtp-Source: AGHT+IHuKWC/c4x41+QSZNJd3lcQoUR6wyVRlABzffvTWdUs6RTvtjN3IU97w2Kq/BMHMP9Eb571CA== X-Received: by 2002:a05:6a21:8181:b0:1a9:793c:59ec with SMTP id pd1-20020a056a21818100b001a9793c59ecmr1438535pzb.13.1714434597446; Mon, 29 Apr 2024 16:49:57 -0700 (PDT) Received: from dread.disaster.area (pa49-179-32-121.pa.nsw.optusnet.com.au. [49.179.32.121]) by smtp.gmail.com with ESMTPSA id lc16-20020a056a004f5000b006f09f711e4esm19265220pfb.151.2024.04.29.16.49.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 16:49:56 -0700 (PDT) Received: from dave by dread.disaster.area with local (Exim 4.96) (envelope-from ) id 1s1akr-00FaLP-2v; Tue, 30 Apr 2024 09:49:53 +1000 Date: Tue, 30 Apr 2024 09:49:53 +1000 From: Dave Chinner To: Vlastimil Babka Cc: Christoph Hellwig , akpm@linux-foundation.org, osalvador@suse.de, elver@google.com, andreyknvl@gmail.com, linux-mm@kvack.org, djwong@kernel.org, linux-xfs@vger.kernel.org Subject: Re: [PATCH] mm,page_owner: don't remove GFP flags in add_stack_record_to_list Message-ID: References: <20240429054706.1543980-1-hch@lst.de> <3e486c7f-57d4-4a36-a949-0cf19f10bf4f@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3e486c7f-57d4-4a36-a949-0cf19f10bf4f@suse.cz> X-Stat-Signature: rrrkiqrgqnern4q4xop3c9o17fqahfto X-Rspam-User: X-Rspamd-Queue-Id: 4C93920006 X-Rspamd-Server: rspam05 X-HE-Tag: 1714434599-331206 X-HE-Meta: U2FsdGVkX1/XDXhbHlwth6zzC3UDJffiMszDeWinjdSMxt/ggMfRfl+qa6dSAloOW6N5b3kyhqQc2zfXuGwO1lprqWWuM2pkw4xs5Iy9P8ULTbaO8DDXxJQyJ7+zJYMvzRKzb+QGvGaKuRLfGJKxkOCCRg0S4MWjnVl/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qC8xysgF/ibnyUmIQuRqPErsx35db3MRk4j1pUiBIA0m7y+XP14uEHrC0Y4BTZ71Wd1pq+xTc5xr/USZOI2sAYZd7FfrVBOcpv2YFqv5hKKxflabmc954c1U5gsq8ZtFPJUB8dxsP0jBypOZIeSoOi28Kcxm5C8HrwZ9kVs+md+lIePJEUeVQxcZo08iCY9nObHLpckJC7Bsw0bAgjuw7JAGruCpLG2c0ZwIVz0BqYbvW4FD7MYemi+ZaZhDul4Ll7eGEwh3HdDFh8UkeWdzj7hE1AitBSkJpMAjsOnUJ3FunUOiSQTFGWoPT 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 Mon, Apr 29, 2024 at 09:59:43AM +0200, Vlastimil Babka wrote: > On 4/29/24 7:47 AM, Christoph Hellwig wrote: > > This loses flags like GFP_NOFS and GFP_NOIO that are important to avoid > > deadlocks as well as GFP_NOLOCKDEP that otherwise generates lockdep false > > positives. > > GFP_NOFS and GFP_NOIO translate to GFP_KERNEL without __GFP_FS/__GFP_IO so I > don't see how this patch would have helped with those. > __GFP_NOLOCKDEP is likely the actual issue and stackdepot solved it like this: > > https://lore.kernel.org/linux-xfs/20240418141133.22950-1-ryabinin.a.a@gmail.com/ > > So we could just do the same here. Yes, it is __GFP_NOLOCKDEP that is the issue here, but cargo-cult-copying of that stackdepot fix is just whack-a-mole bug fixing without addressing the technical debt that got us here in the first place. Has anyone else bothered to look to see if kmemleak has the same problem? If anyone bothered to do an audit, they would see that gfp_kmemleak_mask() handles the reclaim context masks correctly. Further, it adds NOWARN, NOMEMALLOC and NORETRY, which means the debug code is silent when it fails, it doesn't deplete emergency reserves and doesn't bog down retrying forever when there are sustained low memory situations. This also points out that the page-owner/stackdepot code that strips GFP_ZONEMASK is completely redundant. Doing: gfp_flags &= GFP_KERNEL|GFP_ATOMIC|__GFP_NOLOCKDEP; strips everything but __GFP_RECLAIM, __GFP_FS, __GFP_IO, __GFP_HIGH and __GFP_NOLOCKDEP. This already strips the zonemask info, so there's no need to do it explicitly. IOWs, the right way to fix this set of problems is to lift gfp_kmemleak_mask() to include/linux/gfp.h and then use it across all these nested allocations that occur behind the public memory allocation API. I've got a patchset under test at the moment that does this.... -Dave. -- Dave Chinner david@fromorbit.com