On Mon, Apr 23, 2018 at 20:27:36 -0400, Emilio G. Cota wrote:
> On Fri, Apr 13, 2018 at 17:31:20 -1000, Richard Henderson wrote:
> > On 04/05/2018 04:13 PM, Emilio G. Cota wrote:
> > > +#ifdef CONFIG_DEBUG_TCG
> > > +
> > > +struct page_lock_debug {
> > > +    const PageDesc *pd;
> > > +    QLIST_ENTRY(page_lock_debug) entry;
> > > +};
> > > +
> > > +static __thread QLIST_HEAD(, page_lock_debug) page_lock_debug_head;
(snip)
> > Why do you need a separate data structure for this?
> 
> The alternative would be to:
> - reuse page_collection, but in some cases we lock pages without
>   page_collection
> - Expand PageDesc with a bool, but that state would be global
>   and not per-thread, which could hide actual bugs (e.g. we
>   could see that the bool is set and not assert, despite
>   the bool having been set by another thread).
> 
> I figured a per-thread list would be appropriate here,
> since it doesn't have the problems of the above solutions,
> and is simple--and slow, which is why it's under DEBUG_TCG.

In v3 I've changed this to use a per-thread g_hash_table as a
hash map.

                E.

Reply via email to