From patchwork Wed Jul 17 18:12:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13735703 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 DDF17C3DA62 for ; Wed, 17 Jul 2024 18:12:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 694056B0095; Wed, 17 Jul 2024 14:12:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F6CB6B0096; Wed, 17 Jul 2024 14:12:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 420776B0098; Wed, 17 Jul 2024 14:12:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 1931B6B0095 for ; Wed, 17 Jul 2024 14:12:48 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id C100880BDE for ; Wed, 17 Jul 2024 18:12:47 +0000 (UTC) X-FDA: 82350040374.18.13D59B0 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf14.hostedemail.com (Postfix) with ESMTP id 000B810001F for ; Wed, 17 Jul 2024 18:12:45 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=AmhRzG5v; spf=pass (imf14.hostedemail.com: domain of 3nQmYZgYKCEw685s1pu22uzs.q20zw18B-00y9oqy.25u@flex--surenb.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3nQmYZgYKCEw685s1pu22uzs.q20zw18B-00y9oqy.25u@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=1721239927; 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=ygXA0XIa9xBbp7z6zKTfYsdLjjMC6FzyRil3fs2y+xs=; b=X6gvsoUXcvIIC5vKgecVsNoeh3HdCJqXKrr4HheByI4BTBjgKUkdAeWXELLL993slQ5uR+ 39XYEgFDbcGb2t4nFiaRf8aKC0u6XTCMK4+9fIMuY6RG7Os7U3kDldvHnG6lxcUm9cT6F0 rU5DpNnHkfa2NljDDUV5gQE7QYsKsaQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721239927; a=rsa-sha256; cv=none; b=5Cbo8eDhvPiMGC+dL2uqUbsOQbgi7bS6Ei5b4ul1q6VeM4hrr1OV30q5BFQBshTkISPccy v0Bvrjj7pm+XUkXrIOZohbXvi9707+FQ5HyIzeqg2Q4M9Cdjh3v67Ip+k4gJQdwun1XLgw eGW3pmFdDUH35mnQ6zm5tNLBl8JMQkM= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=AmhRzG5v; spf=pass (imf14.hostedemail.com: domain of 3nQmYZgYKCEw685s1pu22uzs.q20zw18B-00y9oqy.25u@flex--surenb.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3nQmYZgYKCEw685s1pu22uzs.q20zw18B-00y9oqy.25u@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e05faf3fdc4so137857276.2 for ; Wed, 17 Jul 2024 11:12:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1721239965; x=1721844765; 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=ygXA0XIa9xBbp7z6zKTfYsdLjjMC6FzyRil3fs2y+xs=; b=AmhRzG5vNtkBdVQ8xV4DG2R57kVPbhNm1R2zXv9x67Enr87EKTmxRRgfFeDYeOfFCJ Os08WU1q75XsbsFMxy8Ce8XJuf+OcjlfMIC/6uefIfE85wd6/1cjLmhrghXE9ZusKHT6 sJVyiDDKYwjfL/ioaaWNkKBN6WlXYt1eaxTZOmtCbQ+eZpnhmlXwr2NOtqnujIhgvI7/ XS9TRM++5QdIaZul2RT1AVYuc+h7ao+114ZbF1BknAot62cqM+a5Pm+LpfgWY9Vdl/EP XDDAlk0wo4mtfxUJeK9CEH2hbS8iDxk8vRIDgXghh2EtzurUqEtt+23mHhkVmNL4Eyhx aR3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721239965; x=1721844765; 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=ygXA0XIa9xBbp7z6zKTfYsdLjjMC6FzyRil3fs2y+xs=; b=onu4sy2umxeHNcuSQz05HPOY59fFL4Jk8jR341m37FV1N3w2dvlF8VN9r5JkmcHOOY gJAISO+PJFRZFVdLVFm1WP6xYVvvOezjasFurRVzkOUJNJu7TagZiX2EUU/puPylgSXq 9Zqx5uv+rQs45fDhyAxqyDUqeHZGh0kVEljsHSV7g0KI57YN5q7zNSiaGhkVtiKPQVe3 29xKIIo5kQbTMChW7ida3axtnJbX5GooZ4TP+sSPU5Yda5ySZ/6LZWGLCB5oOy8huoji GYxwqtNtU9mmpI4YwD0MsJxo07vyEiOWX0ZZtzoJ6oxP9K/6XekVs1klhTHuk9McBGo4 FiWA== X-Forwarded-Encrypted: i=1; AJvYcCWZ1efFhH64m6daN4kwEr3GA2OzLreDAjRRwS71bFnUcD8KMgA7V6gCVhgdxr84jU2fL2b58qkgK9kwR7O03nMjpDo= X-Gm-Message-State: AOJu0YzyJD4sfLTKICAxvQ9fxUqvELekcnOr/L7Y5ln0KjmOQ3kMLYRN K4thBgSWAraQaLb2xBUxFeNy/kRFAE2JLVL77qlHNrMfYpea2plTcbNMzB5Iaoso7I9S7/FBKYt aGw== X-Google-Smtp-Source: AGHT+IGa1owAr+/QUJsrv0druT/r58eUd+kkgRXi2LZMu6lmkvI/Rv/vL7MKUayeWR/KwZcz3SEeOV6KLbc= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:f44b:e467:5c7c:74ab]) (user=surenb job=sendgmr) by 2002:a05:6902:72f:b0:e05:ec8f:b497 with SMTP id 3f1490d57ef6-e05feac7896mr533276.4.1721239965044; Wed, 17 Jul 2024 11:12:45 -0700 (PDT) Date: Wed, 17 Jul 2024 11:12:39 -0700 In-Reply-To: <20240717181239.2510054-1-surenb@google.com> Mime-Version: 1.0 References: <20240717181239.2510054-1-surenb@google.com> X-Mailer: git-send-email 2.45.2.993.g49e7a77208-goog Message-ID: <20240717181239.2510054-2-surenb@google.com> Subject: [PATCH v2 2/2] alloc_tag: outline and export free_reserved_page() From: Suren Baghdasaryan To: akpm@linux-foundation.org Cc: kent.overstreet@linux.dev, hch@infradead.org, 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, kernel test robot X-Rspamd-Queue-Id: 000B810001F X-Stat-Signature: n3cqj38b9rrr5pm7s7nayo6qzuk1b9p5 X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1721239965-566427 X-HE-Meta: U2FsdGVkX18quZaCz5ytklLe/+ax4CNAYIGTnOfPiozyEYQFexEpKFT0V8CtS/01Y+X9yAoV271vl8b35tIalEf1yhx0Cla8M1+6TirdZSmuXUyAAlK6HOsdR7gScTC6kOfJms9MEkjT2soBVjaacYLxr2sDh8HaW4zDxENR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aRiRGebSVU5qrfUr1HHtM1VKlicqAQtRBdyEd2VquzB1ilzCUhxixAPBzU8bcp88HpNdLjvjS91fA5TOFpVdCfBprtANNcX8c6Zg1k3YnseVSvWWgUUzzWEI281RKdD4NCAlm9GWbjUW571J+T8adb00h88MXCHfPSzc3vD/iQjJGqctJWeKHnss9sS6weDp0OkCgE2TuBs46TE1kIoLBVtQTDrsFBW3e5xsJchUYHfVqj5aMve+P4qFnS93LAPBHUALXtI6TKJN0F2t+pDf35mOetNrNnHBWRcS61Tmak5N7JJk8WW3VKITAI+K6uP2Ts4lcrJSB0xmtQmMGVpfnpUQuH5FrPB3V8V37B9024Bq97f5AzTUVPz3yMADDnFVCduevv0Tkep04AHneCL1vdStb9gVO2UUidMBPtp/1slGdGcUS4BPyaflWGlPU5B4lYhLeGqMWvid 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: Outline and export free_reserved_page() because modules use it and it in turn uses page_ext_{get|put} which should not be exported. The same result could be obtained by outlining {get|put}_page_tag_ref() but that would have higher performance impact as these functions are used in more performance critical paths. Fixes: dcfe378c81f7 ("lib: introduce support for page allocation tagging") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202407080044.DWMC9N9I-lkp@intel.com/ Suggested-by: Christoph Hellwig Suggested-by: Vlastimil Babka Signed-off-by: Suren Baghdasaryan Acked-by: Vlastimil Babka --- Changes since v1 [1] - Outlined and exported free_reserved_page() in place of {get|put}_page_tag_ref, per Vlastimil Babka [1] https://lore.kernel.org/all/20240717011631.2150066-2-surenb@google.com/ include/linux/mm.h | 16 +--------------- mm/page_alloc.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index eb7c96d24ac0..b58bad248eef 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3177,21 +3177,7 @@ extern void reserve_bootmem_region(phys_addr_t start, phys_addr_t end, int nid); /* Free the reserved page into the buddy system, so it gets managed. */ -static inline void free_reserved_page(struct page *page) -{ - 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); - } - } - ClearPageReserved(page); - init_page_count(page); - __free_page(page); - adjust_managed_page_count(page, 1); -} +void free_reserved_page(struct page *page); #define free_highmem_page(page) free_reserved_page(page) static inline void mark_page_reserved(struct page *page) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 9ecf99190ea2..7d2fa9f5e750 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5805,6 +5805,23 @@ unsigned long free_reserved_area(void *start, void *end, int poison, const char return pages; } +void free_reserved_page(struct page *page) +{ + 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); + } + } + ClearPageReserved(page); + init_page_count(page); + __free_page(page); + adjust_managed_page_count(page, 1); +} +EXPORT_SYMBOL(free_reserved_page); + static int page_alloc_cpu_dead(unsigned int cpu) { struct zone *zone;