public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org, kirill.shutemov@linux.intel.com
Cc: Sasha Levin <sashal@kernel.org>
Subject: Re: [PATCH 6.12.y] mm/page_alloc: fix race condition in unaccepted memory handling
Date: Tue, 20 May 2025 09:40:27 -0400	[thread overview]
Message-ID: <20250520062522-88efd3e89d1ab487@stable.kernel.org> (raw)
In-Reply-To: <20250520072848.639525-1-kirill.shutemov@linux.intel.com>

[ Sasha's backport helper bot ]

Hi,

Summary of potential issues:
⚠️ Found matching upstream commit but patch is missing proper reference to it

Found matching upstream commit: fefc075182275057ce607effaa3daa9e6e3bdc73

Status in newer kernel trees:
6.14.y | Not found

Note: The patch differs from the upstream commit:
---
1:  fefc075182275 ! 1:  e5e24c3c382e8 mm/page_alloc: fix race condition in unaccepted memory handling
    @@ Commit message
         Cc: Johannes Weiner <hannes@cmpxchg.org>
         Cc: <stable@vger.kernel.org>    [6.5+]
         Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    -
    - ## mm/internal.h ##
    -@@ mm/internal.h: unsigned long move_page_tables(struct pagetable_move_control *pmc);
    - 
    - #ifdef CONFIG_UNACCEPTED_MEMORY
    - void accept_page(struct page *page);
    --void unaccepted_cleanup_work(struct work_struct *work);
    - #else /* CONFIG_UNACCEPTED_MEMORY */
    - static inline void accept_page(struct page *page)
    - {
    -
    - ## mm/mm_init.c ##
    -@@ mm/mm_init.c: static void __meminit zone_init_free_lists(struct zone *zone)
    - 
    - #ifdef CONFIG_UNACCEPTED_MEMORY
    - 	INIT_LIST_HEAD(&zone->unaccepted_pages);
    --	INIT_WORK(&zone->unaccepted_cleanup, unaccepted_cleanup_work);
    - #endif
    - }
    - 
    +    (cherry picked from commit fefc075182275057ce607effaa3daa9e6e3bdc73)
    +    Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
     
      ## mm/page_alloc.c ##
     @@ mm/page_alloc.c: bool has_managed_dma(void)
    @@ mm/page_alloc.c: bool has_managed_dma(void)
     -
      static bool lazy_accept = true;
      
    --void unaccepted_cleanup_work(struct work_struct *work)
    --{
    --	static_branch_dec(&zones_with_unaccepted_pages);
    --}
    --
      static int __init accept_memory_parse(char *p)
    - {
    - 	if (!strcmp(p, "lazy")) {
     @@ mm/page_alloc.c: static bool page_contains_unaccepted(struct page *page, unsigned int order)
      static void __accept_page(struct zone *zone, unsigned long *flags,
      			  struct page *page)
    @@ mm/page_alloc.c: static void __accept_page(struct zone *zone, unsigned long *fla
      
      	__free_pages_ok(page, MAX_PAGE_ORDER, FPI_TO_TAIL);
     -
    --	if (last) {
    --		/*
    --		 * There are two corner cases:
    --		 *
    --		 * - If allocation occurs during the CPU bring up,
    --		 *   static_branch_dec() cannot be used directly as
    --		 *   it causes a deadlock on cpu_hotplug_lock.
    --		 *
    --		 *   Instead, use schedule_work() to prevent deadlock.
    --		 *
    --		 * - If allocation occurs before workqueues are initialized,
    --		 *   static_branch_dec() should be called directly.
    --		 *
    --		 *   Workqueues are initialized before CPU bring up, so this
    --		 *   will not conflict with the first scenario.
    --		 */
    --		if (system_wq)
    --			schedule_work(&zone->unaccepted_cleanup);
    --		else
    --			unaccepted_cleanup_work(&zone->unaccepted_cleanup);
    --	}
    +-	if (last)
    +-		static_branch_dec(&zones_with_unaccepted_pages);
      }
      
      void accept_page(struct page *page)
    @@ mm/page_alloc.c: static bool try_to_accept_memory_one(struct zone *zone)
     -	return static_branch_unlikely(&zones_with_unaccepted_pages);
     -}
     -
    - static bool cond_accept_memory(struct zone *zone, unsigned int order,
    - 			       int alloc_flags)
    + static bool cond_accept_memory(struct zone *zone, unsigned int order)
      {
      	long to_accept, wmark;
      	bool ret = false;
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.12.y       |  Success    |  Success   |

      reply	other threads:[~2025-05-20 13:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-19 13:13 FAILED: patch "[PATCH] mm/page_alloc: fix race condition in unaccepted memory" failed to apply to 6.12-stable tree gregkh
2025-05-20  7:28 ` [PATCH 6.12.y] mm/page_alloc: fix race condition in unaccepted memory handling Kirill A. Shutemov
2025-05-20 13:40   ` Sasha Levin [this message]

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=20250520062522-88efd3e89d1ab487@stable.kernel.org \
    --to=sashal@kernel.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=stable@vger.kernel.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