[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250221-095831-265429292-neomutt-senozhatsky@chromium.org>
Date: Fri, 21 Feb 2025 10:20:24 +0900
From: Sergey Senozhatsky <senozhatsky@...omium.org>
To: Yosry Ahmed <yosry.ahmed@...ux.dev>
Cc: Sergey Senozhatsky <senozhatsky@...omium.org>,
Andrew Morton <akpm@...ux-foundation.org>, Hillf Danton <hdanton@...a.com>, Kairui Song <ryncsn@...il.com>,
Minchan Kim <minchan@...nel.org>, linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 11/17] zsmalloc: make zspage lock preemptible
On (25/02/20 19:18), Yosry Ahmed wrote:
[..]
> > +static void zspage_lock_init(struct zspage *zspage)
> > +{
> > +#ifdef CONFIG_DEBUG_LOCK_ALLOC
> > + lockdep_init_map(&zspage->zsl.dep_map, "zspage->lock",
> > + &zspage->pool->lock_class, 0);
> > +#endif
> > +
> > + spin_lock_init(&zspage->zsl.lock);
> > + zspage->zsl.cnt = ZS_PAGE_UNLOCKED;
> > +}
> > +
> > +#ifdef CONFIG_DEBUG_LOCK_ALLOC
>
> Instead of the #ifdef and repeating all the functions, can't we do
> something like:
>
> #ifdef CONFIG_DEBUG_LOCK_ALLOC
> #define zspage_lock_map(zsl) (&zsl->dep_map)
> #else
> #define zspage_lock_map(zsl) /* empty or NULL */
> #endif
>
> Then we can just have one version of the functions and use
> zspage_lock_map() instead of zsl->dep_map, right?
Yeah, maybe.
Powered by blists - more mailing lists