From patchwork Sat Nov 30 00:14:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13889015 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 B32F6D735E4 for ; Sat, 30 Nov 2024 00:14:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 803A36B0085; Fri, 29 Nov 2024 19:14:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7B1E76B0088; Fri, 29 Nov 2024 19:14:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 62B7E6B0089; Fri, 29 Nov 2024 19:14:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 45EA36B0085 for ; Fri, 29 Nov 2024 19:14:33 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id C6F83C1110 for ; Sat, 30 Nov 2024 00:14:32 +0000 (UTC) X-FDA: 82840839648.06.1DED33E Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) by imf23.hostedemail.com (Postfix) with ESMTP id 2563B140018 for ; Sat, 30 Nov 2024 00:14:24 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=A6d3k2rh; spf=pass (imf23.hostedemail.com: domain of 35VhKZwYKCAIuwtgpdiqqing.eqonkpwz-oomxcem.qti@flex--surenb.bounces.google.com designates 209.85.215.201 as permitted sender) smtp.mailfrom=35VhKZwYKCAIuwtgpdiqqing.eqonkpwz-oomxcem.qti@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1732925667; 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=EpxKrm09+SAPJmqxiOga34L0FlTVIOyjiLSP0mnmo8Q=; b=4ZSAk/Nwtau601Dpnz6A87hFAj+D9vzr2QoZVPiBCRzlKpVg4pGoPJTlOKfNZ0tbtbo7iC lJ7KpVlWbviMGl6t4Ci1vwN2KawJp32Yk6ScD6H1PNbDhsmM1xHCQ5LBF1YyO+3q1wB/23 bv5ldKyIBTIJ0LTrEKH4txNyA+swfjs= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=A6d3k2rh; spf=pass (imf23.hostedemail.com: domain of 35VhKZwYKCAIuwtgpdiqqing.eqonkpwz-oomxcem.qti@flex--surenb.bounces.google.com designates 209.85.215.201 as permitted sender) smtp.mailfrom=35VhKZwYKCAIuwtgpdiqqing.eqonkpwz-oomxcem.qti@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732925667; a=rsa-sha256; cv=none; b=ABzOPte4XNtUjE/+Kt/6QP0XEu+0XppUHgkABzMExp+MOEwfegN/eHM1sFL1lRjrBPCrAF L3V48BQ+5EzggI0o3YpjLgkF5x+yQdTsbMhbukBX5Sk6lg0Kzci2MB5xfGtuClcwDZas12 hl1noUKZ4WVgZ5s/rIS/tBD22XOANKg= Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-7fb96d3a3a8so1700339a12.1 for ; Fri, 29 Nov 2024 16:14:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1732925670; x=1733530470; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=EpxKrm09+SAPJmqxiOga34L0FlTVIOyjiLSP0mnmo8Q=; b=A6d3k2rhbfE0TD4NSWbPTcXNH3s5v0ZtxthzEpGrsNAnp8MymvzQHC1AcvTfoZDtUB 1jo/FpVe9+BpyBdnuHfKDmPy271By9xlobs6CUXYZYvQqFkwZ/MscZmX1Eg4KcsQV8Va mIDx4FiaBt4cFkfkA/btIfySUJ3rjh3DhRJGbSXVkviy2jbVDip6nHn/mAIR3qgYWlLf F/Zph+1Fa1K6sRk423itY9PhnDvleXaI9mxDmeHy2o8ofCMo/5mjNlHbUOdd5if98Ppp 59nb2TwgB3+xPmNaMQs/VvqIMlvRJ661wYs2Sc+kMUSnl3bweqmTMHqRFydUNr8rbFI6 NEiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732925670; x=1733530470; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=EpxKrm09+SAPJmqxiOga34L0FlTVIOyjiLSP0mnmo8Q=; b=dzJKe4V1iN9QcyRN9VQuvgtHixzCIav99A+Svm9eN+Gy86pyzNn3UVxKzHrBXfjvWY z+B7GaOla60F+94cjzKctD6bmp7LY5yXW6TBTjGjUgBiwkWI6FFoIehJNDhVnqsNAg3N 6RL/OehWPyBiMWTP3bG/gpLcVkZGh4ongFltC5PSbRrp/6enboyulRIvIvxJ/VDVJlRI oC6Cs77KHXse3Z212ZFXNhrO0O9D4pC+WoVc2HoFaf0g5EuQdcQRE6cCEz6qCWpfKymz xp+p5ARvAbKAlKS4LCvNr3I54xvjWfd2nGBjWUmedKMcSoYnJAwPgfGEL4qy9dYpZkAN +hjA== X-Forwarded-Encrypted: i=1; AJvYcCVA3QCilMPXGqZpcHxGbLq4SfwtjRQX2K5oTUXZwJmSGMd9bzSGGSkykSb09dZF5B95LosRexrOGA==@kvack.org X-Gm-Message-State: AOJu0Yz/YWQVna5OEHkwBGWnqlLNbIBZsJ4xrg0iLhXNGIiuLvhRo8Qv z0NaZG2NWnoEPsnEbVFwuS6PKMgFMXs7vXhx5EoskHCLjZbXMLg8xNyfI0ANlWY7YwUu4MFZ6II V0A== X-Google-Smtp-Source: AGHT+IEO1jq34I3S812cs/LC0CKsK8aw91gm2TSktbeu+lByPR5ov0es7eD7kBYzK9Z3arRorDrO9sMmpoc= X-Received: from pgvz26.prod.google.com ([2002:a65:665a:0:b0:7ea:618a:6e04]) (user=surenb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:99a5:b0:1e0:df27:10b8 with SMTP id adf61e73a8af0-1e0e0b52839mr22679442637.31.1732925669775; Fri, 29 Nov 2024 16:14:29 -0800 (PST) Date: Fri, 29 Nov 2024 16:14:23 -0800 In-Reply-To: <20241130001423.1114965-1-surenb@google.com> Mime-Version: 1.0 References: <20241130001423.1114965-1-surenb@google.com> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog Message-ID: <20241130001423.1114965-2-surenb@google.com> Subject: [PATCH 2/2] alloc_tag: fix set_codetag_empty() when !CONFIG_MEM_ALLOC_PROFILING_DEBUG From: Suren Baghdasaryan To: akpm@linux-foundation.org Cc: kent.overstreet@linux.dev, pasha.tatashin@soleen.com, rppt@kernel.org, yuzhao@google.com, souravpanda@google.com, 00107082@163.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, surenb@google.com X-Rspamd-Queue-Id: 2563B140018 X-Stat-Signature: 8uxzt39b5at7pux4i1tuzhd1yqceaeke X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1732925664-725272 X-HE-Meta: U2FsdGVkX1+xdP5mLhp/V973MKFIH8GWIcJgSC0nuY+I1oEXjs2cobyZA3++RHn/53Q2grsVKS46snLbM85SyY98DLPgdiEnt6qqQVDtFJqrTiRfW8ajHbDtfV1ivCnfeWVY8CiH5RMlW397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Q/xjd89Ox6YnWiH+Yd1UjB9kDtqtluMgH7PM6CwyEpiMdLsa6bpeSN//hDRV6Tso0Fo3atVdCkLDlqPR+sw92bq8e/z5yf5XbvcbxrcFnIQ9PbJ6rlZdVEdUREeFeILqJyaxgPYIfYUeBa6YhPemeJeIvSKDjk0BzwZ2M0kggAxrI0idRyRz32uPdgIE4QDUxj7lmy2OF8w5OVe15GJSYAJvQcbsQd5Ge0xNP0RT4nkwQVTDINjOEEYu2HCv5XfKRQV2zH9MPs1mDcFB08TOgQrPC31hRLwhf/uWtbovpRCMshaxkpyC8yODEPcK53ls2d0x1J+76KgZ+P7BHA0itioB7ovErHERWyNSGlhoFMth5FBfCbovHSSvGGBzQiCIK32PGrolAfz7SFprT8Xd86RWwNkvzkKydWqtLzGimt7+t4ejBBH89+4eXe88WJeU4QLS0TQ0ueeyFnjGY5YtSPnMI1OOCaPBY62Jvujy9eWloHynhXlUSlw6v8l/I0QAcCvh5P96bDMJqBc3O+NQ49u7F4LYW4q X-Bogosity: Ham, tests=bogofilter, spamicity=0.031133, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: It was recently noticed that set_codetag_empty() might be used not only to mark NULL alloctag references as empty to avoid warnings but also to reset valid tags (in clear_page_tag_ref()). Since set_codetag_empty() is defined as NOOP for CONFIG_MEM_ALLOC_PROFILING_DEBUG=n, such use of set_codetag_empty() leads to subtle bugs. Fix set_codetag_empty() for CONFIG_MEM_ALLOC_PROFILING_DEBUG=n to reset the tag reference. Fixes: a8fc28dad6d5 ("alloc_tag: introduce clear_page_tag_ref() helper function") Reported-by: David Wang <00107082@163.com> Closes: https://lore.kernel.org/lkml/20241124074318.399027-1-00107082@163.com/ Signed-off-by: Suren Baghdasaryan --- Applies over mm-unstable include/linux/alloc_tag.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/linux/alloc_tag.h b/include/linux/alloc_tag.h index 7c0786bdf9af..f6a1b73f5663 100644 --- a/include/linux/alloc_tag.h +++ b/include/linux/alloc_tag.h @@ -63,7 +63,12 @@ static inline void set_codetag_empty(union codetag_ref *ref) #else /* CONFIG_MEM_ALLOC_PROFILING_DEBUG */ static inline bool is_codetag_empty(union codetag_ref *ref) { return false; } -static inline void set_codetag_empty(union codetag_ref *ref) {} + +static inline void set_codetag_empty(union codetag_ref *ref) +{ + if (ref) + ref->ct = NULL; +} #endif /* CONFIG_MEM_ALLOC_PROFILING_DEBUG */