mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
mm: clarify the radix_tree exceptional cases
Make the radix_tree exceptional cases, mostly in filemap.c, clearer. It's hard to devise a suitable snappy name that illuminates the use by shmem/tmpfs for swap, while keeping filemap/pagecache/radix_tree generality. And akpm points out that /* radix_tree_deref_retry(page) */ comments look like calls that have been commented out for unknown reason. Skirt the naming difficulty by rearranging these blocks to handle the transient radix_tree_deref_retry(page) case first; then just explain the remaining shmem/tmpfs swap case in a comment. Signed-off-by: Hugh Dickins <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
e504f3fdd6
commit
8079b1c859
3 changed files with 53 additions and 26 deletions
66
mm/filemap.c
66
mm/filemap.c
|
|
@ -700,10 +700,14 @@ repeat:
|
|||
if (unlikely(!page))
|
||||
goto out;
|
||||
if (radix_tree_exception(page)) {
|
||||
if (radix_tree_exceptional_entry(page))
|
||||
goto out;
|
||||
/* radix_tree_deref_retry(page) */
|
||||
goto repeat;
|
||||
if (radix_tree_deref_retry(page))
|
||||
goto repeat;
|
||||
/*
|
||||
* Otherwise, shmem/tmpfs must be storing a swap entry
|
||||
* here as an exceptional entry: so return it without
|
||||
* attempting to raise page count.
|
||||
*/
|
||||
goto out;
|
||||
}
|
||||
if (!page_cache_get_speculative(page))
|
||||
goto repeat;
|
||||
|
|
@ -838,15 +842,21 @@ repeat:
|
|||
continue;
|
||||
|
||||
if (radix_tree_exception(page)) {
|
||||
if (radix_tree_exceptional_entry(page))
|
||||
continue;
|
||||
if (radix_tree_deref_retry(page)) {
|
||||
/*
|
||||
* Transient condition which can only trigger
|
||||
* when entry at index 0 moves out of or back
|
||||
* to root: none yet gotten, safe to restart.
|
||||
*/
|
||||
WARN_ON(start | i);
|
||||
goto restart;
|
||||
}
|
||||
/*
|
||||
* radix_tree_deref_retry(page):
|
||||
* can only trigger when entry at index 0 moves out of
|
||||
* or back to root: none yet gotten, safe to restart.
|
||||
* Otherwise, shmem/tmpfs must be storing a swap entry
|
||||
* here as an exceptional entry: so skip over it -
|
||||
* we only reach this from invalidate_mapping_pages().
|
||||
*/
|
||||
WARN_ON(start | i);
|
||||
goto restart;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!page_cache_get_speculative(page))
|
||||
|
|
@ -904,14 +914,20 @@ repeat:
|
|||
continue;
|
||||
|
||||
if (radix_tree_exception(page)) {
|
||||
if (radix_tree_exceptional_entry(page))
|
||||
break;
|
||||
if (radix_tree_deref_retry(page)) {
|
||||
/*
|
||||
* Transient condition which can only trigger
|
||||
* when entry at index 0 moves out of or back
|
||||
* to root: none yet gotten, safe to restart.
|
||||
*/
|
||||
goto restart;
|
||||
}
|
||||
/*
|
||||
* radix_tree_deref_retry(page):
|
||||
* can only trigger when entry at index 0 moves out of
|
||||
* or back to root: none yet gotten, safe to restart.
|
||||
* Otherwise, shmem/tmpfs must be storing a swap entry
|
||||
* here as an exceptional entry: so stop looking for
|
||||
* contiguous pages.
|
||||
*/
|
||||
goto restart;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!page_cache_get_speculative(page))
|
||||
|
|
@ -973,13 +989,19 @@ repeat:
|
|||
continue;
|
||||
|
||||
if (radix_tree_exception(page)) {
|
||||
BUG_ON(radix_tree_exceptional_entry(page));
|
||||
if (radix_tree_deref_retry(page)) {
|
||||
/*
|
||||
* Transient condition which can only trigger
|
||||
* when entry at index 0 moves out of or back
|
||||
* to root: none yet gotten, safe to restart.
|
||||
*/
|
||||
goto restart;
|
||||
}
|
||||
/*
|
||||
* radix_tree_deref_retry(page):
|
||||
* can only trigger when entry at index 0 moves out of
|
||||
* or back to root: none yet gotten, safe to restart.
|
||||
* This function is never used on a shmem/tmpfs
|
||||
* mapping, so a swap entry won't be found here.
|
||||
*/
|
||||
goto restart;
|
||||
BUG();
|
||||
}
|
||||
|
||||
if (!page_cache_get_speculative(page))
|
||||
|
|
|
|||
Loading…
Reference in a new issue