Re: [PATCH v3 24/30] mm: memcontrol: prepare for reparenting LRU pages for lruvec lock

From: Qi Zheng

Date: Sun Jan 18 2026 - 22:44:20 EST




On 1/18/26 8:44 AM, Shakeel Butt wrote:
On Fri, Jan 16, 2026 at 05:50:22PM +0800, Qi Zheng wrote:


On 1/16/26 5:43 PM, Muchun Song wrote:


On 2026/1/14 19:32, Qi Zheng wrote:
From: Muchun Song <songmuchun@xxxxxxxxxxxxx>


[...]


It seems that functions marked as `inline` cannot be decorated with
`__acquires`? We’ve had to move these little helpers into `memcontrol.c`
and declare them as extern, but they’re so short that it hardly feels

Right, I received a compilation error reported LKP:

All errors (new ones prefixed by >>):

In file included from crypto/ahash.c:26:
In file included from include/net/netlink.h:6:
In file included from include/linux/netlink.h:9:
In file included from include/net/scm.h:9:
In file included from include/linux/security.h:35:
In file included from include/linux/bpf.h:32:
include/linux/memcontrol.h:772:14: error: use of undeclared identifier
'lruvec'
772 | __acquires(&lruvec->lru_lock)
| ^~~~~~
include/linux/memcontrol.h:773:13: error: use of undeclared identifier
'rcu'
773 | __acquires(rcu)
| ^~~
include/linux/memcontrol.h:775:14: error: use of undeclared identifier
'lruvec'
775 | __acquires(&lruvec->lru_lock)
| ^~~~~~
include/linux/memcontrol.h:776:13: error: use of undeclared identifier
'rcu'
776 | __acquires(rcu)
| ^~~
include/linux/memcontrol.h:779:14: error: use of undeclared identifier
'lruvec'
779 | __acquires(&lruvec->lru_lock)
| ^~~~~~
include/linux/memcontrol.h:780:13: error: use of undeclared identifier
'rcu'
780 | __acquires(rcu)
| ^~~
include/linux/memcontrol.h:1507:13: error: use of undeclared identifier
'rcu'
1507 | __acquires(rcu)
| ^~~
include/linux/memcontrol.h:1515:13: error: use of undeclared identifier
'rcu'
1515 | __releases(rcu)
| ^~~
include/linux/memcontrol.h:1523:13: error: use of undeclared identifier
'rcu'
1523 | __releases(rcu)
| ^~~
include/linux/memcontrol.h:1532:13: error: use of undeclared identifier
'rcu'
1532 | __releases(rcu)

And I reproduced this error with the following configuration:

1. enable CONFIG_WARN_CONTEXT_ANALYSIS_ALL
2. make CC=clang bzImage (clang version >= 22)

worth the trouble. My own inclination is to drop the `__acquires`
annotations—mainly for performance reasons.

If no one else objects, I will drop __acquires/__releases in the next
version.


If you drop these annotations from header file and keep in the C file,
do you still get the compilation error?

I did test it this way, and it does fix the compilation error, but
Muchun thinks these functions are very simple and there's no need to put
them in a C file.