mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-26 06:33:19 -04:00
LUR: Revert "BACKPORT: mm/swapcache: support to handle the shadow entries"
The LRU function is not compatible with GKI, causing GKI to fail to start, so revert. This reverts commit 1968691ba29356ec6e407f6691ccd3fc5b16f38b. Change-Id: I410b200e5c30b6aa189c424ae9afd6c9288c3e40 Reviewed-on: https://gerrit.mot.com/2609775 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
f8a0095395
commit
7a008015a5
5 changed files with 14 additions and 69 deletions
|
|
@ -415,13 +415,10 @@ extern struct address_space *swapper_spaces[];
|
|||
extern unsigned long total_swapcache_pages(void);
|
||||
extern void show_swap_cache_info(void);
|
||||
extern int add_to_swap(struct page *page);
|
||||
extern int add_to_swap_cache(struct page *page, swp_entry_t entry,
|
||||
gfp_t gfp, void **shadowp);
|
||||
extern void __delete_from_swap_cache(struct page *page,
|
||||
swp_entry_t entry, void *shadow);
|
||||
extern int add_to_swap_cache(struct page *, swp_entry_t, gfp_t);
|
||||
extern int __add_to_swap_cache(struct page *page, swp_entry_t entry);
|
||||
extern void __delete_from_swap_cache(struct page *, swp_entry_t entry);
|
||||
extern void delete_from_swap_cache(struct page *);
|
||||
extern void clear_shadow_from_swap_cache(int type, unsigned long begin,
|
||||
unsigned long end);
|
||||
extern void free_page_and_swap_cache(struct page *);
|
||||
extern void free_pages_and_swap_cache(struct page **, int);
|
||||
extern struct page *lookup_swap_cache(swp_entry_t entry,
|
||||
|
|
@ -576,13 +573,13 @@ static inline int add_to_swap(struct page *page)
|
|||
}
|
||||
|
||||
static inline int add_to_swap_cache(struct page *page, swp_entry_t entry,
|
||||
gfp_t gfp_mask, void **shadowp)
|
||||
gfp_t gfp_mask)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline void __delete_from_swap_cache(struct page *page,
|
||||
swp_entry_t entry, void *shadow)
|
||||
swp_entry_t entry)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -590,11 +587,6 @@ static inline void delete_from_swap_cache(struct page *page)
|
|||
{
|
||||
}
|
||||
|
||||
static inline void clear_shadow_from_swap_cache(int type, unsigned long begin,
|
||||
unsigned long end)
|
||||
{
|
||||
}
|
||||
|
||||
static inline int page_swapcount(struct page *page)
|
||||
{
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -1374,7 +1374,7 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc)
|
|||
if (list_empty(&info->swaplist))
|
||||
list_add(&info->swaplist, &shmem_swaplist);
|
||||
|
||||
if (add_to_swap_cache(page, swap, GFP_ATOMIC, NULL) == 0) {
|
||||
if (add_to_swap_cache(page, swap, GFP_ATOMIC) == 0) {
|
||||
spin_lock_irq(&info->lock);
|
||||
shmem_recalc_inode(inode);
|
||||
info->swapped++;
|
||||
|
|
|
|||
|
|
@ -112,14 +112,12 @@ void show_swap_cache_info(void)
|
|||
* add_to_swap_cache resembles add_to_page_cache_locked on swapper_space,
|
||||
* but sets SwapCache flag and private instead of mapping and index.
|
||||
*/
|
||||
int add_to_swap_cache(struct page *page, swp_entry_t entry,
|
||||
gfp_t gfp, void **shadowp)
|
||||
int add_to_swap_cache(struct page *page, swp_entry_t entry, gfp_t gfp)
|
||||
{
|
||||
struct address_space *address_space = swap_address_space(entry);
|
||||
pgoff_t idx = swp_offset(entry);
|
||||
XA_STATE_ORDER(xas, &address_space->i_pages, idx, compound_order(page));
|
||||
unsigned long i, nr = hpage_nr_pages(page);
|
||||
void *old;
|
||||
unsigned long i, nr = compound_nr(page);
|
||||
|
||||
VM_BUG_ON_PAGE(!PageLocked(page), page);
|
||||
VM_BUG_ON_PAGE(PageSwapCache(page), page);
|
||||
|
|
@ -129,25 +127,16 @@ int add_to_swap_cache(struct page *page, swp_entry_t entry,
|
|||
SetPageSwapCache(page);
|
||||
|
||||
do {
|
||||
unsigned long nr_shadows = 0;
|
||||
|
||||
xas_lock_irq(&xas);
|
||||
xas_create_range(&xas);
|
||||
if (xas_error(&xas))
|
||||
goto unlock;
|
||||
for (i = 0; i < nr; i++) {
|
||||
VM_BUG_ON_PAGE(xas.xa_index != idx + i, page);
|
||||
old = xas_load(&xas);
|
||||
if (xa_is_value(old)) {
|
||||
nr_shadows++;
|
||||
if (shadowp)
|
||||
*shadowp = old;
|
||||
}
|
||||
set_page_private(page + i, entry.val + i);
|
||||
xas_store(&xas, page);
|
||||
xas_next(&xas);
|
||||
}
|
||||
address_space->nrexceptional -= nr_shadows;
|
||||
address_space->nrpages += nr;
|
||||
__mod_node_page_state(page_pgdat(page), NR_FILE_PAGES, nr);
|
||||
ADD_CACHE_INFO(add_total, nr);
|
||||
|
|
@ -167,8 +156,7 @@ unlock:
|
|||
* This must be called only on pages that have
|
||||
* been verified to be in the swap cache.
|
||||
*/
|
||||
void __delete_from_swap_cache(struct page *page,
|
||||
swp_entry_t entry, void *shadow)
|
||||
void __delete_from_swap_cache(struct page *page, swp_entry_t entry)
|
||||
{
|
||||
struct address_space *address_space = swap_address_space(entry);
|
||||
int i, nr = hpage_nr_pages(page);
|
||||
|
|
@ -180,14 +168,12 @@ void __delete_from_swap_cache(struct page *page,
|
|||
VM_BUG_ON_PAGE(PageWriteback(page), page);
|
||||
|
||||
for (i = 0; i < nr; i++) {
|
||||
void *entry = xas_store(&xas, shadow);
|
||||
void *entry = xas_store(&xas, NULL);
|
||||
VM_BUG_ON_PAGE(entry != page, entry);
|
||||
set_page_private(page + i, 0);
|
||||
xas_next(&xas);
|
||||
}
|
||||
ClearPageSwapCache(page);
|
||||
if (shadow)
|
||||
address_space->nrexceptional += nr;
|
||||
address_space->nrpages -= nr;
|
||||
__mod_node_page_state(page_pgdat(page), NR_FILE_PAGES, -nr);
|
||||
ADD_CACHE_INFO(del_total, nr);
|
||||
|
|
@ -224,7 +210,7 @@ int add_to_swap(struct page *page)
|
|||
* Add it to the swap cache.
|
||||
*/
|
||||
err = add_to_swap_cache(page, entry,
|
||||
__GFP_HIGH|__GFP_NOMEMALLOC|__GFP_NOWARN, NULL);
|
||||
__GFP_HIGH|__GFP_NOMEMALLOC|__GFP_NOWARN);
|
||||
if (err)
|
||||
/*
|
||||
* add_to_swap_cache() doesn't return -EEXIST, so we can safely
|
||||
|
|
@ -262,44 +248,13 @@ void delete_from_swap_cache(struct page *page)
|
|||
struct address_space *address_space = swap_address_space(entry);
|
||||
|
||||
xa_lock_irq(&address_space->i_pages);
|
||||
__delete_from_swap_cache(page, entry, NULL);
|
||||
__delete_from_swap_cache(page, entry);
|
||||
xa_unlock_irq(&address_space->i_pages);
|
||||
|
||||
put_swap_page(page, entry);
|
||||
page_ref_sub(page, hpage_nr_pages(page));
|
||||
}
|
||||
|
||||
void clear_shadow_from_swap_cache(int type, unsigned long begin,
|
||||
unsigned long end)
|
||||
{
|
||||
unsigned long curr = begin;
|
||||
void *old;
|
||||
|
||||
for (;;) {
|
||||
unsigned long nr_shadows = 0;
|
||||
swp_entry_t entry = swp_entry(type, curr);
|
||||
struct address_space *address_space = swap_address_space(entry);
|
||||
XA_STATE(xas, &address_space->i_pages, curr);
|
||||
|
||||
xa_lock_irq(&address_space->i_pages);
|
||||
xas_for_each(&xas, old, end) {
|
||||
if (!xa_is_value(old))
|
||||
continue;
|
||||
xas_store(&xas, NULL);
|
||||
nr_shadows++;
|
||||
}
|
||||
address_space->nrexceptional -= nr_shadows;
|
||||
xa_unlock_irq(&address_space->i_pages);
|
||||
|
||||
/* search the next swapcache until we meet end */
|
||||
curr >>= SWAP_ADDRESS_SPACE_SHIFT;
|
||||
curr++;
|
||||
curr <<= SWAP_ADDRESS_SPACE_SHIFT;
|
||||
if (curr > end)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If we are the only user, then try to free up the swap cache.
|
||||
*
|
||||
|
|
@ -465,7 +420,7 @@ struct page *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask,
|
|||
__SetPageLocked(new_page);
|
||||
__SetPageSwapBacked(new_page);
|
||||
err = add_to_swap_cache(new_page, entry,
|
||||
gfp_mask & GFP_RECLAIM_MASK, NULL);
|
||||
gfp_mask & GFP_RECLAIM_MASK);
|
||||
if (likely(!err)) {
|
||||
/* Initiate read into locked page */
|
||||
SetPageWorkingset(new_page);
|
||||
|
|
|
|||
|
|
@ -716,7 +716,6 @@ static void add_to_avail_list(struct swap_info_struct *p)
|
|||
static void swap_range_free(struct swap_info_struct *si, unsigned long offset,
|
||||
unsigned int nr_entries)
|
||||
{
|
||||
unsigned long begin = offset;
|
||||
unsigned long end = offset + nr_entries - 1;
|
||||
void (*swap_slot_free_notify)(struct block_device *, unsigned long);
|
||||
|
||||
|
|
@ -742,7 +741,6 @@ static void swap_range_free(struct swap_info_struct *si, unsigned long offset,
|
|||
swap_slot_free_notify(si->bdev, offset);
|
||||
offset++;
|
||||
}
|
||||
clear_shadow_from_swap_cache(si->type, begin, end);
|
||||
}
|
||||
|
||||
static int scan_swap_map_slots(struct swap_info_struct *si,
|
||||
|
|
|
|||
|
|
@ -965,7 +965,7 @@ static int __remove_mapping(struct address_space *mapping, struct page *page,
|
|||
if (PageSwapCache(page)) {
|
||||
swp_entry_t swap = { .val = page_private(page) };
|
||||
mem_cgroup_swapout(page, swap);
|
||||
__delete_from_swap_cache(page, swap, NULL);
|
||||
__delete_from_swap_cache(page, swap);
|
||||
xa_unlock_irqrestore(&mapping->i_pages, flags);
|
||||
put_swap_page(page, swap);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue