diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 78cac3fc3ce5..fed072d472fa 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -461,9 +461,9 @@ static inline pgoff_t linear_page_index(struct vm_area_struct *vma, return pgoff; } -extern void __lock_page(struct page *page); -extern int __lock_page_killable(struct page *page); -extern int __lock_page_or_retry(struct page *page, struct mm_struct *mm, +extern void __sched __lock_page(struct page *page); +extern int __sched __lock_page_killable(struct page *page); +extern int __sched __lock_page_or_retry(struct page *page, struct mm_struct *mm, unsigned int flags); extern void unlock_page(struct page *page); @@ -476,7 +476,7 @@ static inline int trylock_page(struct page *page) /* * lock_page may only be called if we have the page's inode pinned. */ -static inline void lock_page(struct page *page) +static inline __sched void lock_page(struct page *page) { might_sleep(); if (!trylock_page(page)) @@ -488,7 +488,7 @@ static inline void lock_page(struct page *page) * signals. It returns 0 if it locked the page and -EINTR if it was * killed while waiting. */ -static inline int lock_page_killable(struct page *page) +static inline __sched int lock_page_killable(struct page *page) { might_sleep(); if (!trylock_page(page)) @@ -503,8 +503,9 @@ static inline int lock_page_killable(struct page *page) * Return value and mmap_sem implications depend on flags; see * __lock_page_or_retry(). */ -static inline int lock_page_or_retry(struct page *page, struct mm_struct *mm, - unsigned int flags) +static inline __sched int lock_page_or_retry(struct page *page, + struct mm_struct *mm, + unsigned int flags) { might_sleep(); return trylock_page(page) || __lock_page_or_retry(page, mm, flags); @@ -514,8 +515,8 @@ static inline int lock_page_or_retry(struct page *page, struct mm_struct *mm, * This is exported only for wait_on_page_locked/wait_on_page_writeback, etc., * and should not be used directly. */ -extern void wait_on_page_bit(struct page *page, int bit_nr); -extern int wait_on_page_bit_killable(struct page *page, int bit_nr); +extern void __sched wait_on_page_bit(struct page *page, int bit_nr); +extern int __sched wait_on_page_bit_killable(struct page *page, int bit_nr); /* * Wait for a page to be unlocked. @@ -524,13 +525,13 @@ extern int wait_on_page_bit_killable(struct page *page, int bit_nr); * ie with increased "page->count" so that the page won't * go away during the wait.. */ -static inline void wait_on_page_locked(struct page *page) +static inline __sched void wait_on_page_locked(struct page *page) { if (PageLocked(page)) wait_on_page_bit(compound_head(page), PG_locked); } -static inline int wait_on_page_locked_killable(struct page *page) +static inline __sched int wait_on_page_locked_killable(struct page *page) { if (!PageLocked(page)) return 0; @@ -540,7 +541,7 @@ static inline int wait_on_page_locked_killable(struct page *page) /* * Wait for a page to complete writeback */ -static inline void wait_on_page_writeback(struct page *page) +static inline __sched void wait_on_page_writeback(struct page *page) { if (PageWriteback(page)) wait_on_page_bit(page, PG_writeback); diff --git a/include/linux/wait.h b/include/linux/wait.h index ed7c122cb31f..62aa6e0b3149 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -1111,9 +1112,12 @@ void prepare_to_wait(struct wait_queue_head *wq_head, struct wait_queue_entry *w void prepare_to_wait_exclusive(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry, int state); long prepare_to_wait_event(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry, int state); void finish_wait(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry); -long wait_woken(struct wait_queue_entry *wq_entry, unsigned mode, long timeout); -int woken_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int sync, void *key); -int autoremove_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int sync, void *key); +long __sched wait_woken(struct wait_queue_entry *wq_entry, unsigned int mode, + long timeout); +int __sched woken_wake_function(struct wait_queue_entry *wq_entry, + unsigned int mode, int sync, void *key); +int __sched autoremove_wake_function(struct wait_queue_entry *wq_entry, + unsigned int mode, int sync, void *key); #define DEFINE_WAIT_FUNC(name, function) \ struct wait_queue_entry name = { \ diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c index 5dd47f1103d1..0de9dcfde495 100644 --- a/kernel/sched/wait.c +++ b/kernel/sched/wait.c @@ -370,7 +370,8 @@ void finish_wait(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_en } EXPORT_SYMBOL(finish_wait); -int autoremove_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int sync, void *key) +int __sched autoremove_wake_function(struct wait_queue_entry *wq_entry, + unsigned int mode, int sync, void *key) { int ret = default_wake_function(wq_entry, mode, sync, key); @@ -406,7 +407,8 @@ static inline bool is_kthread_should_stop(void) * } smp_mb(); // C * remove_wait_queue(&wq_head, &wait); wq_entry->flags |= WQ_FLAG_WOKEN; */ -long wait_woken(struct wait_queue_entry *wq_entry, unsigned mode, long timeout) +long __sched wait_woken(struct wait_queue_entry *wq_entry, unsigned int mode, + long timeout) { /* * The below executes an smp_mb(), which matches with the full barrier @@ -431,7 +433,8 @@ long wait_woken(struct wait_queue_entry *wq_entry, unsigned mode, long timeout) } EXPORT_SYMBOL(wait_woken); -int woken_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int sync, void *key) +int __sched woken_wake_function(struct wait_queue_entry *wq_entry, + unsigned int mode, int sync, void *key) { /* Pairs with the smp_store_mb() in wait_woken(). */ smp_mb(); /* C */ diff --git a/mm/filemap.c b/mm/filemap.c index aea71dc89dcd..82d1a339a551 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1095,7 +1095,7 @@ static void wake_up_page(struct page *page, int bit) wake_up_page_bit(page, bit); } -static inline int wait_on_page_bit_common(wait_queue_head_t *q, +static inline __sched int wait_on_page_bit_common(wait_queue_head_t *q, struct page *page, int bit_nr, int state, bool lock) { struct wait_page_queue wait_page; @@ -1167,14 +1167,14 @@ static inline int wait_on_page_bit_common(wait_queue_head_t *q, return ret; } -void wait_on_page_bit(struct page *page, int bit_nr) +void __sched wait_on_page_bit(struct page *page, int bit_nr) { wait_queue_head_t *q = page_waitqueue(page); wait_on_page_bit_common(q, page, bit_nr, TASK_UNINTERRUPTIBLE, false); } EXPORT_SYMBOL(wait_on_page_bit); -int wait_on_page_bit_killable(struct page *page, int bit_nr) +int __sched wait_on_page_bit_killable(struct page *page, int bit_nr) { wait_queue_head_t *q = page_waitqueue(page); return wait_on_page_bit_common(q, page, bit_nr, TASK_KILLABLE, false); @@ -1306,7 +1306,7 @@ EXPORT_SYMBOL_GPL(page_endio); * __lock_page - get a lock on the page, assuming we need to sleep to get it * @__page: the page to lock */ -void __lock_page(struct page *__page) +void __sched __lock_page(struct page *__page) { struct page *page = compound_head(__page); wait_queue_head_t *q = page_waitqueue(page); @@ -1314,7 +1314,7 @@ void __lock_page(struct page *__page) } EXPORT_SYMBOL(__lock_page); -int __lock_page_killable(struct page *__page) +int __sched __lock_page_killable(struct page *__page) { struct page *page = compound_head(__page); wait_queue_head_t *q = page_waitqueue(page); @@ -1333,7 +1333,7 @@ EXPORT_SYMBOL_GPL(__lock_page_killable); * If neither ALLOW_RETRY nor KILLABLE are set, will always return 1 * with the page locked and the mmap_sem unperturbed. */ -int __lock_page_or_retry(struct page *page, struct mm_struct *mm, +int __sched __lock_page_or_retry(struct page *page, struct mm_struct *mm, unsigned int flags) { if (flags & FAULT_FLAG_ALLOW_RETRY) {