On Fri, 26 Apr 2019 18:26:42 +0800 Yafang Shao <laoar.shao@xxxxxxxxx> wrote: > Recently there're some hungtasks on our server due to > wait_on_page_writeback, and we want to know the details of this > PG_writeback, i.e. this page is writing back to which device. > But it is not so convenient to get the details. > > I think it would be better to introduce a tracepoint for diagnosing > the writeback details. Fair enough, I guess. > --- a/include/linux/pagemap.h > +++ b/include/linux/pagemap.h > @@ -537,15 +537,7 @@ static inline int wait_on_page_locked_killable(struct page *page) > > extern void put_and_wait_on_page_locked(struct page *page); > > -/* > - * Wait for a page to complete writeback > - */ > -static inline void wait_on_page_writeback(struct page *page) > -{ > - if (PageWriteback(page)) > - wait_on_page_bit(page, PG_writeback); > -} > - > +void wait_on_page_writeback(struct page *page); > extern void end_page_writeback(struct page *page); > void wait_for_stable_page(struct page *page); > > ... > > +/* > + * Wait for a page to complete writeback > + */ > +void wait_on_page_writeback(struct page *page) > +{ > + if (PageWriteback(page)) { > + trace_wait_on_page_writeback(page, page_mapping(page)); > + wait_on_page_bit(page, PG_writeback); > + } > +} > +EXPORT_SYMBOL_GPL(wait_on_page_writeback); But this is a stealth change to the wait_on_page_writeback() licensing. I will get sad emails from developers of accidentally-broken out-of-tree filesystems. We can discuss changing the licensing, but this isn't the way to do it! --- a/mm/page-writeback.c~mm-page-writeback-introduce-tracepoint-for-wait_on_page_writeback-fix +++ a/mm/page-writeback.c @@ -2818,7 +2818,7 @@ void wait_on_page_writeback(struct page wait_on_page_bit(page, PG_writeback); } } -EXPORT_SYMBOL_GPL(wait_on_page_writeback); +EXPORT_SYMBOL(wait_on_page_writeback); /** * wait_for_stable_page() - wait for writeback to finish, if necessary. _