From: Mel Gorman <mgorman@techsingularity.net>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Nicolas Saenz Julienne <nsaenzju@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
Vlastimil Babka <vbabka@suse.cz>,
Michal Hocko <mhocko@kernel.org>, Hugh Dickins <hughd@google.com>,
Yu Zhao <yuzhao@google.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
LKML <linux-kernel@vger.kernel.org>,
Linux-MM <linux-mm@kvack.org>
Subject: [PATCH] mm/page_alloc: replace local_lock with normal spinlock -fix -fix
Date: Fri, 8 Jul 2022 15:44:06 +0100 [thread overview]
Message-ID: <20220708144406.GJ27531@techsingularity.net> (raw)
pcpu_spin_unlock and pcpu_spin_unlock_irqrestore both unlock
pcp->lock and then enable preemption. This lacks symmetry against
both the pcpu_spin helpers and differs from how local_unlock_* is
implemented. While this is harmless, it's unnecessary and it's generally
better to unwind locks and preemption state in the reverse order as
they were acquired.
This is a fix on top of the mm-unstable patch
mm-page_alloc-replace-local_lock-with-normal-spinlock-fix.patch
Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
---
mm/page_alloc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 934d1b5a5449..d0141e51e613 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -192,14 +192,14 @@ static DEFINE_MUTEX(pcp_batch_high_lock);
#define pcpu_spin_unlock(member, ptr) \
({ \
- spin_unlock(&ptr->member); \
pcpu_task_unpin(); \
+ spin_unlock(&ptr->member); \
})
#define pcpu_spin_unlock_irqrestore(member, ptr, flags) \
({ \
- spin_unlock_irqrestore(&ptr->member, flags); \
pcpu_task_unpin(); \
+ spin_unlock_irqrestore(&ptr->member, flags); \
})
/* struct per_cpu_pages specific helpers. */
next reply other threads:[~2022-07-08 14:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-08 14:44 Mel Gorman [this message]
2022-07-08 14:54 ` Vlastimil Babka
2022-07-08 15:58 ` Mel Gorman
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=20220708144406.GJ27531@techsingularity.net \
--to=mgorman@techsingularity.net \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=m.szyprowski@samsung.com \
--cc=mhocko@kernel.org \
--cc=mtosatti@redhat.com \
--cc=nsaenzju@redhat.com \
--cc=vbabka@suse.cz \
--cc=yuzhao@google.com \
/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