mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
mm: swap: remove 'synchronous' argument to swap_read_folio()
Commit [1] introduced IO polling support duding swapin to reduce swap read latency for block devices that can be polled. However later commit [2] removed polling support. Commit [3] removed the remnants of polling support from read_swap_cache_async() and __read_swap_cache_async(). However, it left behind some remnants in swap_read_folio(), the 'synchronous' argument. swap_read_folio() reads the folio synchronously if synchronous=true or if SWP_SYNCHRONOUS_IO is set in swap_info_struct. The only caller that passes synchronous=true is in do_swap_page() in the SWP_SYNCHRONOUS_IO case. Hence, the argument is redundant, it is only set to true when the swap read would have been synchronous anyway. Remove it. [1] Commit23955622ff
("swap: add block io poll in swapin path") [2] Commit9650b453a3
("block: ignore RWF_HIPRI hint for sync dio") [3] Commitb243dcbf2f
("swap: remove remnants of polling from read_swap_cache_async") Link: https://lkml.kernel.org/r/20240607045515.1836558-1-yosryahmed@google.com Signed-off-by: Yosry Ahmed <yosryahmed@google.com> Reviewed-by: "Huang, Ying" <ying.huang@intel.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
90b8fab5cd
commit
b2d1f38b52
@ -4115,7 +4115,7 @@ vm_fault_t do_swap_page(struct vm_fault *vmf)
|
|||||||
|
|
||||||
/* To provide entry to swap_read_folio() */
|
/* To provide entry to swap_read_folio() */
|
||||||
folio->swap = entry;
|
folio->swap = entry;
|
||||||
swap_read_folio(folio, true, NULL);
|
swap_read_folio(folio, NULL);
|
||||||
folio->private = NULL;
|
folio->private = NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -493,10 +493,10 @@ static void swap_read_folio_bdev_async(struct folio *folio,
|
|||||||
submit_bio(bio);
|
submit_bio(bio);
|
||||||
}
|
}
|
||||||
|
|
||||||
void swap_read_folio(struct folio *folio, bool synchronous,
|
void swap_read_folio(struct folio *folio, struct swap_iocb **plug)
|
||||||
struct swap_iocb **plug)
|
|
||||||
{
|
{
|
||||||
struct swap_info_struct *sis = swp_swap_info(folio->swap);
|
struct swap_info_struct *sis = swp_swap_info(folio->swap);
|
||||||
|
bool synchronous = sis->flags & SWP_SYNCHRONOUS_IO;
|
||||||
bool workingset = folio_test_workingset(folio);
|
bool workingset = folio_test_workingset(folio);
|
||||||
unsigned long pflags;
|
unsigned long pflags;
|
||||||
bool in_thrashing;
|
bool in_thrashing;
|
||||||
@ -521,7 +521,7 @@ void swap_read_folio(struct folio *folio, bool synchronous,
|
|||||||
folio_unlock(folio);
|
folio_unlock(folio);
|
||||||
} else if (data_race(sis->flags & SWP_FS_OPS)) {
|
} else if (data_race(sis->flags & SWP_FS_OPS)) {
|
||||||
swap_read_folio_fs(folio, plug);
|
swap_read_folio_fs(folio, plug);
|
||||||
} else if (synchronous || (sis->flags & SWP_SYNCHRONOUS_IO)) {
|
} else if (synchronous) {
|
||||||
swap_read_folio_bdev_sync(folio, sis);
|
swap_read_folio_bdev_sync(folio, sis);
|
||||||
} else {
|
} else {
|
||||||
swap_read_folio_bdev_async(folio, sis);
|
swap_read_folio_bdev_async(folio, sis);
|
||||||
|
@ -11,8 +11,7 @@ struct mempolicy;
|
|||||||
/* linux/mm/page_io.c */
|
/* linux/mm/page_io.c */
|
||||||
int sio_pool_init(void);
|
int sio_pool_init(void);
|
||||||
struct swap_iocb;
|
struct swap_iocb;
|
||||||
void swap_read_folio(struct folio *folio, bool do_poll,
|
void swap_read_folio(struct folio *folio, struct swap_iocb **plug);
|
||||||
struct swap_iocb **plug);
|
|
||||||
void __swap_read_unplug(struct swap_iocb *plug);
|
void __swap_read_unplug(struct swap_iocb *plug);
|
||||||
static inline void swap_read_unplug(struct swap_iocb *plug)
|
static inline void swap_read_unplug(struct swap_iocb *plug)
|
||||||
{
|
{
|
||||||
@ -83,8 +82,7 @@ static inline unsigned int folio_swap_flags(struct folio *folio)
|
|||||||
}
|
}
|
||||||
#else /* CONFIG_SWAP */
|
#else /* CONFIG_SWAP */
|
||||||
struct swap_iocb;
|
struct swap_iocb;
|
||||||
static inline void swap_read_folio(struct folio *folio, bool do_poll,
|
static inline void swap_read_folio(struct folio *folio, struct swap_iocb **plug)
|
||||||
struct swap_iocb **plug)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
static inline void swap_write_unplug(struct swap_iocb *sio)
|
static inline void swap_write_unplug(struct swap_iocb *sio)
|
||||||
|
@ -567,7 +567,7 @@ struct folio *read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask,
|
|||||||
mpol_cond_put(mpol);
|
mpol_cond_put(mpol);
|
||||||
|
|
||||||
if (page_allocated)
|
if (page_allocated)
|
||||||
swap_read_folio(folio, false, plug);
|
swap_read_folio(folio, plug);
|
||||||
return folio;
|
return folio;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -684,7 +684,7 @@ struct folio *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask,
|
|||||||
if (!folio)
|
if (!folio)
|
||||||
continue;
|
continue;
|
||||||
if (page_allocated) {
|
if (page_allocated) {
|
||||||
swap_read_folio(folio, false, &splug);
|
swap_read_folio(folio, &splug);
|
||||||
if (offset != entry_offset) {
|
if (offset != entry_offset) {
|
||||||
folio_set_readahead(folio);
|
folio_set_readahead(folio);
|
||||||
count_vm_event(SWAP_RA);
|
count_vm_event(SWAP_RA);
|
||||||
@ -701,7 +701,7 @@ skip:
|
|||||||
&page_allocated, false);
|
&page_allocated, false);
|
||||||
if (unlikely(page_allocated)) {
|
if (unlikely(page_allocated)) {
|
||||||
zswap_folio_swapin(folio);
|
zswap_folio_swapin(folio);
|
||||||
swap_read_folio(folio, false, NULL);
|
swap_read_folio(folio, NULL);
|
||||||
}
|
}
|
||||||
return folio;
|
return folio;
|
||||||
}
|
}
|
||||||
@ -834,7 +834,7 @@ static struct folio *swap_vma_readahead(swp_entry_t targ_entry, gfp_t gfp_mask,
|
|||||||
if (!folio)
|
if (!folio)
|
||||||
continue;
|
continue;
|
||||||
if (page_allocated) {
|
if (page_allocated) {
|
||||||
swap_read_folio(folio, false, &splug);
|
swap_read_folio(folio, &splug);
|
||||||
if (addr != vmf->address) {
|
if (addr != vmf->address) {
|
||||||
folio_set_readahead(folio);
|
folio_set_readahead(folio);
|
||||||
count_vm_event(SWAP_RA);
|
count_vm_event(SWAP_RA);
|
||||||
@ -853,7 +853,7 @@ skip:
|
|||||||
&page_allocated, false);
|
&page_allocated, false);
|
||||||
if (unlikely(page_allocated)) {
|
if (unlikely(page_allocated)) {
|
||||||
zswap_folio_swapin(folio);
|
zswap_folio_swapin(folio);
|
||||||
swap_read_folio(folio, false, NULL);
|
swap_read_folio(folio, NULL);
|
||||||
}
|
}
|
||||||
return folio;
|
return folio;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user