On Tue, Jun 08, 2021 at 12:29:04AM +0000, Liam Howlett wrote: > * Alex Sierra <alex.sierra@xxxxxxx> [210607 16:43]: > > From: Ralph Campbell <rcampbell@xxxxxxxxxx> > > > > There are several places where ZONE_DEVICE struct pages assume a reference > > count == 1 means the page is idle and free. Instead of open coding this, > > add a helper function to hide this detail. > > > > diff --git a/include/linux/dax.h b/include/linux/dax.h > > index b52f084aa643..8909a91cd381 100644 > > --- a/include/linux/dax.h > > +++ b/include/linux/dax.h > > @@ -243,6 +243,16 @@ static inline bool dax_mapping(struct address_space *mapping) > > return mapping->host && IS_DAX(mapping->host); > > } > > > > +static inline bool dax_layout_is_idle_page(struct page *page) > > +{ > > + return page_ref_count(page) == 1; > > +} > > If this races with page_ref_count(page) == 0, then it will return false > that a page is idle when the page is being freed. I don't know the code > well enough to say if this is an issue or not so please let me know. > > For example: > !dax_layout_is_idle_page() will return true in dax_busy_page() above > when the count is 0 and return the page. > > Maybe you are sure to have at least one reference when calling this? It > might be worth adding a comment. You're getting confused by the problem that the next patch fixes, which is that devmap pages were stupidly given an elevated refcount. devmap pages are considered "free" when their refcount is 1. See put_page(), put_devmap_managed_page() and so on. _______________________________________________ amd-gfx mailing list amd-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/amd-gfx