Message ID | 20240430054604.4169568-4-david@fromorbit.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 9DA00C4345F for <linux-mm@archiver.kernel.org>; Tue, 30 Apr 2024 05:46:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0D01A6B0092; Tue, 30 Apr 2024 01:46:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 057916B008A; Tue, 30 Apr 2024 01:46:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E6B616B008C; Tue, 30 Apr 2024 01:46:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id C3A986B0088 for <linux-mm@kvack.org>; Tue, 30 Apr 2024 01:46:18 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 796641C08C5 for <linux-mm@kvack.org>; Tue, 30 Apr 2024 05:46:18 +0000 (UTC) X-FDA: 82065112836.18.3C5AD1F Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.53]) by imf10.hostedemail.com (Postfix) with ESMTP id A959AC000A for <linux-mm@kvack.org>; Tue, 30 Apr 2024 05:46:16 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=fromorbit-com.20230601.gappssmtp.com header.s=20230601 header.b=FrGf3saE; dmarc=pass (policy=quarantine) header.from=fromorbit.com; spf=pass (imf10.hostedemail.com: domain of david@fromorbit.com designates 209.85.210.53 as permitted sender) smtp.mailfrom=david@fromorbit.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714455976; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=NV4GJbGFzoY56PgdrQSIf6/6C14cbaCO2NcKy+lGqTw=; b=0sFmhf4DlzEjh+NLkG+bQW1qhT8v4cMiZtvKQPXrWOF5Cd6/v0vTBFf+CQTrSIZnf0OMMz OMxRqU6BzzKtTltozOC+2vVTNQpcJNTAxfVPSfn/NKmrbg/+giLciStnejtnELZoe+gOea GG1fMI+piBL+g8pJQdWN/WnuSCIkzxc= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=fromorbit-com.20230601.gappssmtp.com header.s=20230601 header.b=FrGf3saE; dmarc=pass (policy=quarantine) header.from=fromorbit.com; spf=pass (imf10.hostedemail.com: domain of david@fromorbit.com designates 209.85.210.53 as permitted sender) smtp.mailfrom=david@fromorbit.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714455976; a=rsa-sha256; cv=none; b=kZ1v2BTXbggmqwroq2xmo5uC3GUFBxPMAvufxy15rS2ddRelfqUFrcwAswwQuIsdMn/0Q4 lBBRB8N9mi+QFsS2+A6xJ0SLI2HNXje0ZQ6v2kVt2SDEEoNp1/5e8mWVW9gE5+Q+MXuMC5 UKHUWlDfxGtAiJLYkGgCEAr9AxP9U3E= Received: by mail-ot1-f53.google.com with SMTP id 46e09a7af769-6ee1b203f30so1413138a34.0 for <linux-mm@kvack.org>; Mon, 29 Apr 2024 22:46:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fromorbit-com.20230601.gappssmtp.com; s=20230601; t=1714455975; x=1715060775; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NV4GJbGFzoY56PgdrQSIf6/6C14cbaCO2NcKy+lGqTw=; b=FrGf3saEKNIIupUiMli3xWnPQ839CrKgnL8EIx9mGaCfN2t+3v8cSURUKQPseNdCWV /msSHMnUHn5bYE42IM2i8cSbwFgkaPsVBOCBs3fzyulH/0gLbnh7m8Ed+Pumxx38dAch Go6PulHAEKctJ+ovItO2di/wXokM8VAalnPyfjwlMpAj0uahTBu4aL6UdU2Gt13f32gc 1xbTBxL8HC9J1uedqomGy/5MFhm5GqAXkHKzvFR4Pcv8ctNP0gHcFFNP2oE3q81xqW0y 25Z5aU3fFjWhCy4T6jNID23MIKCcuXfC5NbXBKYJ7ZsNwvo0chAltvQvz9+4BkUv8f0c nXOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714455975; x=1715060775; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NV4GJbGFzoY56PgdrQSIf6/6C14cbaCO2NcKy+lGqTw=; b=JjlgQrWahyEGrRxXiXq0iUBYZ5Heg0JLEdZ+NcDd48t4l3M845vHRBCi3pd4/e1DtP J3MHA4AaV6brW7Eh1qGxMyTt8DbpAYm+Xg65vvnuJY2HurCzmvZdvRm0kE+aEIJlsCfq llwYmI+vK3VZHDXGSE3qfp4FRdZc/V4BB+OT2sL4kZ0Vjj9sQpS8xYEgNTvLH3fVcIPs ooF/KPWPzXwGiZqW1nPCYQOHgBknPuH4kHZNS65U5VALOgWUOaG2/1RTb3d2EFBuKzss 2ID/NKNiJ2LLOsWZ60jkzES/xK3uI5tqzQ8g2g0CGS6SHRM9O1hpSiiGW8R9BR7gNcz/ gcrg== X-Gm-Message-State: AOJu0Yx1p4NEiCBFMKztbuluEa4q1tqQ+VN8QnyWwilZZqH7GFrqvqkb XOhiU2yXX1iJ4tC5GFRrV/B3Wz23+z3B3rd+9Wa8+LAlYrw/YB786moC9I/N/p/sWpqkJWL+peF H X-Google-Smtp-Source: AGHT+IHSe22zH9AEzfdykd197j0sgft4/vE2xJ+69aNwgLdPObVthGLdo/lyUt2tlIufut/wICnAyg== X-Received: by 2002:a05:6871:3308:b0:22e:fec:707a with SMTP id nf8-20020a056871330800b0022e0fec707amr11386433oac.19.1714455975418; Mon, 29 Apr 2024 22:46:15 -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 gs9-20020a056a004d8900b006e694719fa0sm20968511pfb.147.2024.04.29.22.46.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 22:46:14 -0700 (PDT) Received: from [192.168.253.23] (helo=devoid.disaster.area) by dread.disaster.area with esmtp (Exim 4.96) (envelope-from <dave@fromorbit.com>) id 1s1gJg-00FsCN-2N; Tue, 30 Apr 2024 15:46:12 +1000 Received: from dave by devoid.disaster.area with local (Exim 4.97) (envelope-from <dave@devoid.disaster.area>) id 1s1gJg-0000000HUwz-0uIM; Tue, 30 Apr 2024 15:46:12 +1000 From: Dave Chinner <david@fromorbit.com> To: linux-mm@kvack.org, linux-xfs@vger.kernel.org Cc: akpm@linux-foundation.org, hch@lst.de, osalvador@suse.de, elver@google.com, vbabka@suse.cz, andreyknvl@gmail.com Subject: [PATCH 3/3] mm/page-owner: use gfp_nested_mask() instead of open coded masking Date: Tue, 30 Apr 2024 15:28:25 +1000 Message-ID: <20240430054604.4169568-4-david@fromorbit.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240430054604.4169568-1-david@fromorbit.com> References: <20240430054604.4169568-1-david@fromorbit.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam01 X-Stat-Signature: h1wxgruwosgdpupneyfg37ijw4zb1u7e X-Rspam-User: X-Rspamd-Queue-Id: A959AC000A X-HE-Tag: 1714455976-142929 X-HE-Meta: U2FsdGVkX1/nUesX/WkaHup5AEgOH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MQWWTNVTi/vqrTXVGeaii6bTdpm5JbnwzmU5x6hW1ni4AiqmPNHmud7a+yMSu5xeMsXMON7eQ8+qtNl2Kp+5mMczLO2f/QVv1I0W7mFVAOgz1EksaKAFHqub5hysaczOuud1QiBZjz+iDePOvus4gfs+TtMV+Y28r8pe/zp6+Mtq9YHrlejDCtRQQKV7mfJrDOzYqCDx7PsqmMeoSvivZnyrfqPRq3e6WAM5IsojgmSsfwQJe18dpUcWQuWmf0kE8xcHOQDFxoidfAmOWdQaDOOtdXLA64dbpl44nM9qCU/yKF3sFS6c6whGNxh5tfH0ITTHlKAjd5tg5nNYMu6I+Ls24zkS8K04fms17jcHmpyKKT6OzkUn2+k9du8= X-Bogosity: Ham, tests=bogofilter, spamicity=0.001410, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
mm: fix nested allocation context filtering
|
expand
|
diff --git a/mm/page_owner.c b/mm/page_owner.c index 742f432e5bf0..55e89c34f0cd 100644 --- a/mm/page_owner.c +++ b/mm/page_owner.c @@ -168,13 +168,8 @@ static void add_stack_record_to_list(struct stack_record *stack_record, unsigned long flags; struct stack *stack; - /* Filter gfp_mask the same way stackdepot does, for consistency */ - gfp_mask &= ~GFP_ZONEMASK; - gfp_mask &= (GFP_ATOMIC | GFP_KERNEL); - gfp_mask |= __GFP_NOWARN; - set_current_in_page_owner(); - stack = kmalloc(sizeof(*stack), gfp_mask); + stack = kmalloc(sizeof(*stack), gfp_nested_mask(gfp_mask)); if (!stack) { unset_current_in_page_owner(); return;
The page-owner tracking code records stack traces during page allocation. To do this, it must do a memory allocation for the stack information from inside an existing memory allocation context. This internal allocation must obey the high level caller allocation constraints to avoid generating false positive warnings that have nothing to do with the code they are instrumenting/tracking (e.g. through lockdep reclaim state tracking) We also don't want recording stack traces to deplete emergency memory reserves - debug code is useless if it creates new issues that can't be replicated when the debug code is disabled. Switch the stack tracking allocation masking to use gfp_nested_mask() to address these issues. gfp_nested_mask() naturally strips GFP_ZONEMASK, too, which greatly simplifies this code. Signed-off-by: Dave Chinner <dchinner@redhat.com> --- mm/page_owner.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)