From: Andrew Morton <akpm@linux-foundation.org>
To: Mateusz Guzik <mjguzik@gmail.com>
Cc: muchun.song@linux.dev, dave@stgolabs.net,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] mm/hugetlb: sort out global lock annotations
Date: Wed, 28 Aug 2024 13:44:35 -0700 [thread overview]
Message-ID: <20240828134435.443d7f7ec65eba1db4436434@linux-foundation.org> (raw)
In-Reply-To: <CAGudoHE73o5oK77iOFKqH4D4Cz6t9TAu4882+_F9vHH7muNH-A@mail.gmail.com>
On Wed, 28 Aug 2024 22:13:49 +0200 Mateusz Guzik <mjguzik@gmail.com> wrote:
> > It's conventional (within MM, at least) to put the section thing at the
> > end of the definition, so tweak:
> >
> > --- a/mm/hugetlb.c~mm-hugetlb-sort-out-global-lock-annotations-fix
> > +++ a/mm/hugetlb.c
> > @@ -72,14 +72,14 @@ static unsigned int default_hugepages_in
> > * Protects updates to hugepage_freelists, hugepage_activelist, nr_huge_pages,
> > * free_huge_pages, and surplus_huge_pages.
> > */
> > -__cacheline_aligned_in_smp DEFINE_SPINLOCK(hugetlb_lock);
> > +DEFINE_SPINLOCK(hugetlb_lock) __cacheline_aligned_in_smp;
> >
>
> I tried things in this order and this does not compile for me:
> In file included from ./arch/x86/include/asm/current.h:10,
> from ./arch/x86/include/asm/preempt.h:7,
> from ./include/linux/preempt.h:79,
> from ./include/linux/spinlock.h:56,
> from ./include/linux/mmzone.h:8,
> from ./include/linux/gfp.h:7,
> from ./include/linux/mm.h:7,
> from mm/hugetlb.c:8:
> ./include/linux/cache.h:80:3: error: expected ‘,’ or ‘;’ before ‘__attribute__’
> 80 | __attribute__((__aligned__(SMP_CACHE_BYTES), \
> | ^~~~~~~~~~~~~
> ./include/linux/cache.h:86:36: note: in expansion of macro ‘__cacheline_aligned’
> 86 | #define __cacheline_aligned_in_smp __cacheline_aligned
> | ^~~~~~~~~~~~~~~~~~~
> mm/hugetlb.c:75:31: note: in expansion of macro ‘__cacheline_aligned_in_smp’
> 75 | DEFINE_SPINLOCK(hugetlb_lock) __cacheline_aligned_in_smp;
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~
Well that's annoying. It's because DEFINE_SPINLOCK includes an initializer.
--- a/mm/hugetlb.c~mm-hugetlb-sort-out-global-lock-annotations-fix-fix
+++ a/mm/hugetlb.c
@@ -72,7 +72,7 @@ static unsigned int default_hugepages_in
* Protects updates to hugepage_freelists, hugepage_activelist, nr_huge_pages,
* free_huge_pages, and surplus_huge_pages.
*/
-DEFINE_SPINLOCK(hugetlb_lock) __cacheline_aligned_in_smp;
+spinlock_t hugetlb_lock __cacheline_aligned_in_smp = __SPIN_LOCK_UNLOCKED(hugetlb_lock);
/*
* Serializes faults on the same logical page. This is used to
_
We'd need a new DEFINE_SPINLOCK_ALIGNED() or something.
Ho hum, I'll fix.
next prev parent reply other threads:[~2024-08-28 20:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-28 16:07 Mateusz Guzik
2024-08-28 19:49 ` Andrew Morton
2024-08-28 20:13 ` Mateusz Guzik
2024-08-28 20:44 ` Andrew Morton [this message]
2024-08-28 21:02 ` Mateusz Guzik
2024-08-28 21:39 ` Andrew Morton
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=20240828134435.443d7f7ec65eba1db4436434@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=dave@stgolabs.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mjguzik@gmail.com \
--cc=muchun.song@linux.dev \
/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
all inboxes | Powered by JetHome®