From 8c3fc59e08b952533be16932c02e4897fd7e2a35 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 2 Nov 2021 16:12:50 +0100 Subject: [PATCH] Revert "ANDROID: attribute page lock and waitqueue functions as sched" This reverts commit dec0fd4a0385ddd89b983aa75e68b8015d610229. It causes too many merge issues with upstream commits, and due to the age, really should have been sent upstream. Revert it and if it really is needed, the developers can add it back when needed. Bug: 144961676 Bug: 144713689 Bug: 172212772 Cc: Minchan Kim Cc: Jimmy Shiu Cc: Will McVicker Signed-off-by: Greg Kroah-Hartman Change-Id: I667d51c9d53a701f273c64bf7aa337848b458c1c --- include/linux/pagemap.h | 13 ++++++------- kernel/sched/wait.c | 8 +++----- mm/filemap.c | 14 +++++++------- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index f91f5271cf97..512dfb8fe17a 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -15,7 +15,6 @@ #include #include /* for in_interrupt() */ #include -#include struct pagevec; @@ -616,7 +615,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 __sched void lock_page(struct page *page) +static inline void lock_page(struct page *page) { might_sleep(); if (!trylock_page(page)) @@ -628,7 +627,7 @@ static inline __sched 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 __sched int lock_page_killable(struct page *page) +static inline int lock_page_killable(struct page *page) { might_sleep(); if (!trylock_page(page)) @@ -644,7 +643,7 @@ static inline __sched int lock_page_killable(struct page *page) * Returns 0 if the page is locked successfully, or -EIOCBQUEUED if the page * was already locked and the callback defined in 'wait' was queued. */ -static inline __sched int lock_page_async(struct page *page, +static inline int lock_page_async(struct page *page, struct wait_page_queue *wait) { if (!trylock_page(page)) @@ -659,7 +658,7 @@ static inline __sched int lock_page_async(struct page *page, * Return value and mmap_lock implications depend on flags; see * __lock_page_or_retry(). */ -static inline __sched int lock_page_or_retry(struct page *page, struct mm_struct *mm, +static inline int lock_page_or_retry(struct page *page, struct mm_struct *mm, unsigned int flags) { might_sleep(); @@ -680,13 +679,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 __sched void wait_on_page_locked(struct page *page) +static inline void wait_on_page_locked(struct page *page) { if (PageLocked(page)) wait_on_page_bit(compound_head(page), PG_locked); } -static inline __sched int wait_on_page_locked_killable(struct page *page) +static inline int wait_on_page_locked_killable(struct page *page) { if (!PageLocked(page)) return 0; diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c index a5975579a741..76577d1642a5 100644 --- a/kernel/sched/wait.c +++ b/kernel/sched/wait.c @@ -404,8 +404,7 @@ void finish_wait(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_en } EXPORT_SYMBOL(finish_wait); -__sched int autoremove_wake_function(struct wait_queue_entry *wq_entry, unsigned int mode, - int sync, void *key) +int autoremove_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int sync, void *key) { int ret = default_wake_function(wq_entry, mode, sync, key); @@ -441,7 +440,7 @@ static inline bool is_kthread_should_stop(void) * } smp_mb(); // C * remove_wait_queue(&wq_head, &wait); wq_entry->flags |= WQ_FLAG_WOKEN; */ -__sched long wait_woken(struct wait_queue_entry *wq_entry, unsigned int mode, long timeout) +long wait_woken(struct wait_queue_entry *wq_entry, unsigned mode, long timeout) { /* * The below executes an smp_mb(), which matches with the full barrier @@ -466,8 +465,7 @@ __sched long wait_woken(struct wait_queue_entry *wq_entry, unsigned int mode, lo } EXPORT_SYMBOL(wait_woken); -__sched int woken_wake_function(struct wait_queue_entry *wq_entry, unsigned int mode, - int sync, void *key) +int woken_wake_function(struct wait_queue_entry *wq_entry, unsigned 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 0369dbf03bff..dae481293b5d 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1272,7 +1272,7 @@ static inline bool trylock_page_bit_common(struct page *page, int bit_nr, /* How many times do we accept lock stealing from under a waiter? */ int sysctl_page_lock_unfairness = 5; -static inline __sched int wait_on_page_bit_common(wait_queue_head_t *q, +static inline int wait_on_page_bit_common(wait_queue_head_t *q, struct page *page, int bit_nr, int state, enum behavior behavior) { int unfairness = sysctl_page_lock_unfairness; @@ -1411,14 +1411,14 @@ repeat: return wait->flags & WQ_FLAG_WOKEN ? 0 : -EINTR; } -__sched void wait_on_page_bit(struct page *page, int bit_nr) +void 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, SHARED); } EXPORT_SYMBOL(wait_on_page_bit); -__sched int wait_on_page_bit_killable(struct page *page, int bit_nr) +int 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, SHARED); @@ -1641,7 +1641,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 */ -__sched void __lock_page(struct page *__page) +void __lock_page(struct page *__page) { struct page *page = compound_head(__page); wait_queue_head_t *q = page_waitqueue(page); @@ -1650,7 +1650,7 @@ __sched void __lock_page(struct page *__page) } EXPORT_SYMBOL(__lock_page); -__sched int __lock_page_killable(struct page *__page) +int __lock_page_killable(struct page *__page) { struct page *page = compound_head(__page); wait_queue_head_t *q = page_waitqueue(page); @@ -1659,7 +1659,7 @@ __sched int __lock_page_killable(struct page *__page) } EXPORT_SYMBOL_GPL(__lock_page_killable); -__sched int __lock_page_async(struct page *page, struct wait_page_queue *wait) +int __lock_page_async(struct page *page, struct wait_page_queue *wait) { struct wait_queue_head *q = page_waitqueue(page); int ret = 0; @@ -1696,7 +1696,7 @@ __sched int __lock_page_async(struct page *page, struct wait_page_queue *wait) * If neither ALLOW_RETRY nor KILLABLE are set, will always return 1 * with the page locked and the mmap_lock unperturbed. */ -__sched int __lock_page_or_retry(struct page *page, struct mm_struct *mm, +int __lock_page_or_retry(struct page *page, struct mm_struct *mm, unsigned int flags) { if (fault_flag_allow_retry_first(flags)) {