linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Mike Rapoport <rppt@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: David Hildenbrand <david@redhat.com>,
	Doug Berger <opendmb@gmail.com>,
	Matthew Wilcox <willy@infradead.org>,
	Mel Gorman <mgorman@suse.de>, Michal Hocko <mhocko@kernel.org>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org,
	linux-mm@kvack.org
Subject: Re: [PATCH v2 02/14] mm/page_alloc: add helper for checking if check_pages_enabled
Date: Wed, 22 Mar 2023 12:38:36 +0100	[thread overview]
Message-ID: <b142ad8b-36a2-7d96-1fb0-2b1e82634fc5@suse.cz> (raw)
In-Reply-To: <20230321170513.2401534-3-rppt@kernel.org>

On 3/21/23 18:05, Mike Rapoport wrote:
> From: "Mike Rapoport (IBM)" <rppt@kernel.org>
> 
> Instead of duplicating long static_branch_enabled(&check_pages_enabled)
> wrap it in a helper function is_check_pages_enabled()
> 
> Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
> Reviewed-by: David Hildenbrand <david@redhat.com>

Reviewed-by: Vlastimil Babka <vbabka@suse.cz>

> ---
>  mm/page_alloc.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 87d760236dba..e1149d54d738 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -245,6 +245,11 @@ EXPORT_SYMBOL(init_on_free);
>  /* perform sanity checks on struct pages being allocated or freed */
>  static DEFINE_STATIC_KEY_MAYBE(CONFIG_DEBUG_VM, check_pages_enabled);
>  
> +static inline bool is_check_pages_enabled(void)
> +{
> +	return static_branch_unlikely(&check_pages_enabled);
> +}
> +
>  static bool _init_on_alloc_enabled_early __read_mostly
>  				= IS_ENABLED(CONFIG_INIT_ON_ALLOC_DEFAULT_ON);
>  static int __init early_init_on_alloc(char *buf)
> @@ -1443,7 +1448,7 @@ static __always_inline bool free_pages_prepare(struct page *page,
>  		for (i = 1; i < (1 << order); i++) {
>  			if (compound)
>  				bad += free_tail_pages_check(page, page + i);
> -			if (static_branch_unlikely(&check_pages_enabled)) {
> +			if (is_check_pages_enabled()) {
>  				if (unlikely(free_page_is_bad(page + i))) {
>  					bad++;
>  					continue;
> @@ -1456,7 +1461,7 @@ static __always_inline bool free_pages_prepare(struct page *page,
>  		page->mapping = NULL;
>  	if (memcg_kmem_online() && PageMemcgKmem(page))
>  		__memcg_kmem_uncharge_page(page, order);
> -	if (static_branch_unlikely(&check_pages_enabled)) {
> +	if (is_check_pages_enabled()) {
>  		if (free_page_is_bad(page))
>  			bad++;
>  		if (bad)
> @@ -2366,7 +2371,7 @@ static int check_new_page(struct page *page)
>  
>  static inline bool check_new_pages(struct page *page, unsigned int order)
>  {
> -	if (static_branch_unlikely(&check_pages_enabled)) {
> +	if (is_check_pages_enabled()) {
>  		for (int i = 0; i < (1 << order); i++) {
>  			struct page *p = page + i;
>  


  reply	other threads:[~2023-03-22 11:38 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-21 17:04 [PATCH v2 00/14] mm: move core MM initialization to mm/mm_init.c Mike Rapoport
2023-03-21 17:05 ` [PATCH v2 01/14] mips: fix comment about pgtable_init() Mike Rapoport
2023-03-22 11:36   ` Vlastimil Babka
2023-03-21 17:05 ` [PATCH v2 02/14] mm/page_alloc: add helper for checking if check_pages_enabled Mike Rapoport
2023-03-22 11:38   ` Vlastimil Babka [this message]
2023-03-21 17:05 ` [PATCH v2 03/14] mm: move most of core MM initialization to mm/mm_init.c Mike Rapoport
2023-03-22 14:26   ` Vlastimil Babka
2023-03-21 17:05 ` [PATCH v2 04/14] mm: handle hashdist initialization in mm/mm_init.c Mike Rapoport
2023-03-22 14:49   ` Vlastimil Babka
2023-03-22 15:00     ` Mike Rapoport
2023-03-21 17:05 ` [PATCH v2 05/14] mm/page_alloc: rename page_alloc_init() to page_alloc_init_cpuhp() Mike Rapoport
2023-03-22 14:50   ` Vlastimil Babka
2023-03-21 17:05 ` [PATCH v2 06/14] init: fold build_all_zonelists() and page_alloc_init_cpuhp() to mm_init() Mike Rapoport
2023-03-22 16:10   ` Vlastimil Babka
2023-03-22 20:26     ` Mike Rapoport
2023-03-23  7:09       ` Vlastimil Babka
2023-03-21 17:05 ` [PATCH v2 07/14] init,mm: move mm_init() to mm/mm_init.c and rename it to mm_core_init() Mike Rapoport
2023-03-22 16:24   ` Vlastimil Babka
2023-03-21 17:05 ` [PATCH v2 08/14] mm: call {ptlock,pgtable}_cache_init() directly from mm_core_init() Mike Rapoport
2023-03-22  9:06   ` Sergei Shtylyov
2023-03-22 10:08     ` Mike Rapoport
2023-03-22 11:18       ` David Hildenbrand
2023-03-22 16:27       ` Vlastimil Babka
2023-03-21 17:05 ` [PATCH v2 09/14] mm: move init_mem_debugging_and_hardening() to mm/mm_init.c Mike Rapoport
2023-03-22 16:28   ` Vlastimil Babka
2023-03-21 17:05 ` [PATCH v2 10/14] init,mm: fold late call to page_ext_init() to page_alloc_init_late() Mike Rapoport
2023-03-22 16:30   ` Vlastimil Babka
2023-03-21 17:05 ` [PATCH v2 11/14] mm: move mem_init_print_info() to mm_init.c Mike Rapoport
2023-03-22 16:32   ` Vlastimil Babka
2023-03-21 17:05 ` [PATCH v2 12/14] mm: move kmem_cache_init() declaration to mm/slab.h Mike Rapoport
2023-03-22 16:33   ` Vlastimil Babka
2023-03-21 17:05 ` [PATCH v2 13/14] mm: move vmalloc_init() declaration to mm/internal.h Mike Rapoport
2023-03-22 16:33   ` Vlastimil Babka
2023-03-21 17:05 ` [PATCH v2 14/14] MAINTAINERS: extend memblock entry to include MM initialization Mike Rapoport
2023-03-22 16:34   ` Vlastimil Babka
2023-03-22 11:19 ` [PATCH v2 00/14] mm: move core MM initialization to mm/mm_init.c David Hildenbrand
  -- strict thread matches above, loose matches on Subject: below --
2023-03-21 14:48 [PATCH v2 01/14] mips: fix comment about pgtable_init() Mike Rapoport
2023-03-21 14:48 ` [PATCH v2 02/14] mm/page_alloc: add helper for checking if check_pages_enabled Mike Rapoport

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b142ad8b-36a2-7d96-1fb0-2b1e82634fc5@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mhocko@kernel.org \
    --cc=opendmb@gmail.com \
    --cc=rppt@kernel.org \
    --cc=tsbogend@alpha.franken.de \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).