From patchwork Mon Aug 12 19:24:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13760963 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 B3DD5C3DA7F for ; Mon, 12 Aug 2024 19:24:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 205CF6B008C; Mon, 12 Aug 2024 15:24:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1B6906B0095; Mon, 12 Aug 2024 15:24:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 02DE96B009F; Mon, 12 Aug 2024 15:24:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id D70406B008C for ; Mon, 12 Aug 2024 15:24:35 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 4BFEF40381 for ; Mon, 12 Aug 2024 19:24:35 +0000 (UTC) X-FDA: 82444570110.02.EC03CCC Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf18.hostedemail.com (Postfix) with ESMTP id 937FB1C0002 for ; Mon, 12 Aug 2024 19:24:33 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=xNrqNg5e; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf18.hostedemail.com: domain of 3cGG6ZgYKCFkJLI5E27FF7C5.3FDC9ELO-DDBM13B.FI7@flex--surenb.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3cGG6ZgYKCFkJLI5E27FF7C5.3FDC9ELO-DDBM13B.FI7@flex--surenb.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723490595; 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: references:dkim-signature; bh=yWxCowPUnixbfZzlA8QQGBp8dYSP6RfE8f5Q6sz/520=; b=v/KIDvyeBniCPs/c4bxgpNR0f2F7GmScFrOMBqsv2E604cx9sOBTVARrWx2ey6w2fjDznJ EE2iO7/W2SbaZ8YxOUnOPokxX2Ui+vM69SZ1Fzn7aIqB6NFB3sm0uzzPvfPlOR3tNJVKee HXOX6+6aotpkgzfJ0WXE3RwO5cQWdxo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723490595; a=rsa-sha256; cv=none; b=siFTg3Ang0nlUgSiPsNxfuAwceOYI6gg2v8rglwpMuZ8DR4zYIr5a3v2w7kEoYAUXpCRxj 8PVklDKa3F6qZ2W8E1v2eSNw6rGu0W9kpcbVgclmjlha4m7f2EFROYiOeITvzdqKxk1WwL g9kfWJZq122i5SA0wo8yeFWA54KPUFQ= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=xNrqNg5e; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf18.hostedemail.com: domain of 3cGG6ZgYKCFkJLI5E27FF7C5.3FDC9ELO-DDBM13B.FI7@flex--surenb.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3cGG6ZgYKCFkJLI5E27FF7C5.3FDC9ELO-DDBM13B.FI7@flex--surenb.bounces.google.com Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e0bb206570aso8526214276.3 for ; Mon, 12 Aug 2024 12:24:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1723490672; x=1724095472; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=yWxCowPUnixbfZzlA8QQGBp8dYSP6RfE8f5Q6sz/520=; b=xNrqNg5esuHOYa8gPMekulDjY6h7dwmD+Mkf9V1yyEYt1VpP/XbwJMVqmIYWuQt4Aj 628hM7EWp3Qv7wshLI/YsGPBKGcM/0o1dLAgveCmtnoGKH2Gd7WDOSqiQhhWP9FudZ2U 4NQiO3I9dskpkDRauCtRxsk2uydh+NRHFnjTg0I9eXR0oHIru0ceFUvTuWN03jJBTfQ6 /NmrQT3GZjIHfjuHtXxCUxZ8RQyh5tdKyBDMOOWpeRdOn/XHZoQkROPGJXfDOUSEyASv kXjWWBwzsuEk3244++44Cy1ItRavNMR5pxu8JJ2xuQHYr0ut+Rq7n+BHJ4LniY7F32c9 uI2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723490672; x=1724095472; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=yWxCowPUnixbfZzlA8QQGBp8dYSP6RfE8f5Q6sz/520=; b=HJ7oZoXaWX5VxgZsv0WIP7Bz1uiwCem4gEC6Zu9V+GYOjyZMqKnKCnwd63JPQ/hpdy bPU8iKE9UzDanCaFUbzfdfsAQ9oiRt0DMZTUl64wfcVV4t1a21MrH+1+WenLZ4Mszr/7 9I+W2Ojk4YQDeyX9UZ3LpCfo1NfvpKDjPNDOADh56lnJg7fHEaOImwg9PwOTpbML49XK csm32CQfk/acJwPGe7jebkWjLaEC4bvu6ZoIPDw0gEJfD//urs79c47jCxRhwLLHsWcz grh4HrGLQZijHZ3kA6a9e0nJLnsoiOosH+zZWA15H8J7kbCc7O7ee6u+4kROe7VAaFbu NcwQ== X-Forwarded-Encrypted: i=1; AJvYcCVw4y6NARjeCHcXvdGeEQNh8E8KysXd96AwB2VKhzKYMpAb7GgMbivQc8GLhe9x16I59kysXhQDjtFHczaZejGpPU0= X-Gm-Message-State: AOJu0YyeiZr7FgYT7kdXPkdofrUp7/91PHSDHL121/XgYRA4tEnh3hT5 +Ag75WMw2XzVBQM0h2fm3B2vLIba+0A2YG1D1Siiz+eY01bWT1njwlE+zVmlY2eFm1vKdO60tPa sFA== X-Google-Smtp-Source: AGHT+IHKisNvsfNZ3HwptFVUwpuAndJrP1cg0JwL0YzNRZLFI3LjSNR5DwFlUuA9GavrzBxidgbOnP1w9Ro= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:3912:1e97:a514:421a]) (user=surenb job=sendgmr) by 2002:a25:bc06:0:b0:dfb:1c1c:abf9 with SMTP id 3f1490d57ef6-e113cd5ee6fmr74667276.2.1723490672597; Mon, 12 Aug 2024 12:24:32 -0700 (PDT) Date: Mon, 12 Aug 2024 12:24:28 -0700 Mime-Version: 1.0 X-Mailer: git-send-email 2.46.0.76.ge559c4bf1a-goog Message-ID: <20240812192428.151825-1-surenb@google.com> Subject: [PATCH v2 1/1] alloc_tag: mark pages reserved during CMA activation as not tagged From: Suren Baghdasaryan To: akpm@linux-foundation.org Cc: kent.overstreet@linux.dev, vbabka@suse.cz, pasha.tatashin@soleen.com, souravpanda@google.com, keescook@chromium.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, surenb@google.com, stable@vger.kernel.org X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 937FB1C0002 X-Stat-Signature: 4g6osnmk1zf7wmofkjfj89yt4eqmsrgx X-Rspam-User: X-HE-Tag: 1723490673-172930 X-HE-Meta: U2FsdGVkX18QnskmUx1LmFHW+fTrFVjH+YLHGQhhuTn4G3xiEpT1Ff0kFT86qCfi1dvKUklcLob/9Lp/UyrvDfZhLjU74d/ipTU6+SEW+hNJkzRaUFGKFnWVR1VEzmQ9ZXZV+MJGq3c9CBtn3jGn3bkYcJAcc+HoLMj97rLd3PoyYNo2UH3/KsI7ep4feGn112y3b2iiJ8J6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wmxI+hf13ArG3tLgrx4k5Z0SI23tdZKjSkH28VyXwgzQ2oW30shNMxvDAK5M2qpPBeInWE5XHT7SwJq4lVe5+lKUZ557cfrBYDpHUoYYTjA6Guv6qafW0UDGRh8wbABRy7aSoVWpx+lgs1QVOrkO2JLE0WVY/9TZNIYFnmbMsF90AkKBhTHH7nKhcq5++3qOgtM5rVbX4WLGE2+HqmlOvnhlpKFHiQ+Q70peo0IxKE4lxyo/YR2P4VDnFEXlKkXgb1EYg7Xo8hBYdO0slHfVJt8PldSMaBXzfX0VY0dKvbiU7bkRjy1n3Eg9sZ2if1JRUK5JfyWf4EFDFg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000788, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: During CMA activation, pages in CMA area are prepared and then freed without being allocated. This triggers warnings when memory allocation debug config (CONFIG_MEM_ALLOC_PROFILING_DEBUG) is enabled. Fix this by marking these pages not tagged before freeing them. Fixes: d224eb0287fb ("codetag: debug: mark codetags for reserved pages as empty") Signed-off-by: Suren Baghdasaryan Cc: stable@vger.kernel.org # v6.10 --- changes since v1 [1] - Added Fixes tag - CC'ed stable [1] https://lore.kernel.org/all/20240812184455.86580-1-surenb@google.com/ mm/mm_init.c | 10 ++++++++++ 1 file changed, 10 insertions(+) base-commit: d74da846046aeec9333e802f5918bd3261fb5509 diff --git a/mm/mm_init.c b/mm/mm_init.c index 75c3bd42799b..ec9324653ad9 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -2245,6 +2245,16 @@ void __init init_cma_reserved_pageblock(struct page *page) set_pageblock_migratetype(page, MIGRATE_CMA); set_page_refcounted(page); + + /* pages were reserved and not allocated */ + if (mem_alloc_profiling_enabled()) { + union codetag_ref *ref = get_page_tag_ref(page); + + if (ref) { + set_codetag_empty(ref); + put_page_tag_ref(ref); + } + } __free_pages(page, pageblock_order); adjust_managed_page_count(page, pageblock_nr_pages);