From: Jan Kara <jack@suse.cz>
To: Matthew Wilcox <willy@infradead.org>
Cc: <linux-fsdevel@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>, Jan Kara <jack@suse.cz>
Subject: [PATCH 13/23] mm: Use xas_store_noinit() when storing non-NULL
Date: Wed, 22 Apr 2020 17:02:46 +0200 [thread overview]
Message-ID: <20200422150256.23473-14-jack@suse.cz> (raw)
In-Reply-To: <20200422150256.23473-1-jack@suse.cz>
When we store value different from NULL, xas_store_noinit() is
equivalent to xas_store(). Transition these places to
xas_store_noinit().
Signed-off-by: Jan Kara <jack@suse.cz>
---
mm/filemap.c | 6 +++---
mm/khugepaged.c | 6 +++---
mm/migrate.c | 6 +++---
mm/shmem.c | 4 ++--
mm/swap_state.c | 2 +-
5 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/mm/filemap.c b/mm/filemap.c
index 48c488b505ad..4fb515d8c242 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -134,7 +134,7 @@ static void page_cache_delete(struct address_space *mapping,
VM_BUG_ON_PAGE(PageTail(page), page);
VM_BUG_ON_PAGE(nr != 1 && shadow, page);
- xas_store(&xas, shadow);
+ xas_store_noinit(&xas, shadow);
xas_init_marks(&xas);
page->mapping = NULL;
@@ -803,7 +803,7 @@ int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask)
new->index = offset;
xas_lock_irqsave(&xas, flags);
- xas_store(&xas, new);
+ xas_store_noinit(&xas, new);
old->mapping = NULL;
/* hugetlb pages do not participate in page cache accounting. */
@@ -856,7 +856,7 @@ static int __add_to_page_cache_locked(struct page *page,
old = xas_load(&xas);
if (old && !xa_is_value(old))
xas_set_err(&xas, -EEXIST);
- xas_store(&xas, page);
+ xas_store_noinit(&xas, page);
if (xas_error(&xas))
goto unlock;
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 8da820c02de7..79e5f0d12517 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -1588,7 +1588,7 @@ static void collapse_file(struct mm_struct *mm,
result = SCAN_FAIL;
goto xa_locked;
}
- xas_store(&xas, new_page);
+ xas_store_noinit(&xas, new_page);
nr_none++;
continue;
}
@@ -1724,7 +1724,7 @@ static void collapse_file(struct mm_struct *mm,
list_add_tail(&page->lru, &pagelist);
/* Finally, replace with the new page. */
- xas_store(&xas, new_page);
+ xas_store_noinit(&xas, new_page);
continue;
out_unlock:
unlock_page(page);
@@ -1828,7 +1828,7 @@ static void collapse_file(struct mm_struct *mm,
/* Unfreeze the page. */
list_del(&page->lru);
page_ref_unfreeze(page, 2);
- xas_store(&xas, page);
+ xas_store_noinit(&xas, page);
xas_pause(&xas);
xas_unlock_irq(&xas);
unlock_page(page);
diff --git a/mm/migrate.c b/mm/migrate.c
index 7160c1556f79..1610b7336af8 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -459,13 +459,13 @@ int migrate_page_move_mapping(struct address_space *mapping,
SetPageDirty(newpage);
}
- xas_store(&xas, newpage);
+ xas_store_noinit(&xas, newpage);
if (PageTransHuge(page)) {
int i;
for (i = 1; i < HPAGE_PMD_NR; i++) {
xas_next(&xas);
- xas_store(&xas, newpage);
+ xas_store_noinit(&xas, newpage);
}
}
@@ -536,7 +536,7 @@ int migrate_huge_page_move_mapping(struct address_space *mapping,
get_page(newpage);
- xas_store(&xas, newpage);
+ xas_store_noinit(&xas, newpage);
page_ref_unfreeze(page, expected_count - 1);
diff --git a/mm/shmem.c b/mm/shmem.c
index bd8840082c94..35a4abd9b417 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -361,7 +361,7 @@ static int shmem_replace_entry(struct address_space *mapping,
item = xas_load(&xas);
if (item != expected)
return -ENOENT;
- xas_store(&xas, replacement);
+ xas_store_noinit(&xas, replacement);
return 0;
}
@@ -631,7 +631,7 @@ static int shmem_add_to_page_cache(struct page *page,
if (xas_error(&xas))
goto unlock;
next:
- xas_store(&xas, page);
+ xas_store_noinit(&xas, page);
if (++i < nr) {
xas_next(&xas);
goto next;
diff --git a/mm/swap_state.c b/mm/swap_state.c
index ebed37bbf7a3..1afbf68f1724 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -133,7 +133,7 @@ int add_to_swap_cache(struct page *page, swp_entry_t entry, gfp_t gfp)
for (i = 0; i < nr; i++) {
VM_BUG_ON_PAGE(xas.xa_index != idx + i, page);
set_page_private(page + i, entry.val + i);
- xas_store(&xas, page);
+ xas_store_noinit(&xas, page);
xas_next(&xas);
}
address_space->nrpages += nr;
--
2.16.4
next prev parent reply other threads:[~2020-04-22 15:03 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-22 15:02 [PATCH 0/23 v2] mm: Speedup page cache truncation Jan Kara
2020-04-22 15:02 ` [PATCH 01/23] xarray: Remove stale comment Jan Kara
2020-04-22 15:02 ` [PATCH 02/23] xarray: Provide xas_erase() and xas_store_noinit() helpers Jan Kara
2020-04-22 15:02 ` [PATCH 03/23] xarray: Use xas_store_noinit() in __xa_store, __xa_insert, __xa_alloc Jan Kara
2020-04-22 15:02 ` [PATCH 04/23] xarray: Switch xa_store_range() to use xas_store_noinit() Jan Kara
2020-04-22 15:02 ` [PATCH 05/23] xarray: Use xas_erase() in __xa_erase() Jan Kara
2020-04-22 15:02 ` [PATCH 06/23] xarray: Explicitely set XA_FREE_MARK in __xa_cmpxchg() Jan Kara
2020-04-22 15:02 ` [PATCH 07/23] xarray: Switch __xa_cmpxchg() to use xas_store_noinit() Jan Kara
2020-04-22 15:02 ` [PATCH 08/23] dax: Use xas_erase() in __dax_invalidate_entry() Jan Kara
2020-04-22 15:02 ` [PATCH 09/23] dax: Use dax_store_noinit() in grab_mapping_entry() Jan Kara
2020-04-22 15:02 ` [PATCH 10/23] dax: Convert xas_store() to xas_store_noinit() Jan Kara
2020-04-22 15:02 ` [PATCH 11/23] mm: Use xas_erase() in page_cache_delete_batch() Jan Kara
2020-04-22 15:02 ` [PATCH 12/23] mm: Use xas_erase() in collapse_file() Jan Kara
2020-04-22 15:02 ` Jan Kara [this message]
2020-04-22 15:02 ` [PATCH 14/23] workingset: Use xas_store_noinit() to clear shadow entry Jan Kara
2020-04-22 15:02 ` [PATCH 15/23] swap: Use xas_erase() when removing page from swap cache Jan Kara
2020-04-22 15:02 ` [PATCH 16/23] idr: Use xas_erase() in ida_destroy() Jan Kara
2020-04-22 15:02 ` [PATCH 17/23] idr: Use xas_erase() in ida_free() Jan Kara
2020-04-22 15:02 ` [PATCH 18/23] idr: Convert xas_store() to xas_store_noinit() Jan Kara
2020-04-22 15:02 ` [PATCH 19/23] testing: Use xas_erase() to remove entries from xarray Jan Kara
2020-04-22 15:02 ` [PATCH 20/23] testing: Use xas_store_noinit() for non-NULL entries Jan Kara
2020-04-22 15:02 ` [PATCH 21/23] testing: Introduce xa_erase_order() and use it Jan Kara
2020-04-22 15:02 ` [PATCH 22/23] testing: Switch xa_store_order() to xas_store_noinit() Jan Kara
2020-04-22 15:02 ` [PATCH 23/23] xarray: Remove xas_store() Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200422150256.23473-14-jack@suse.cz \
--to=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).