fdff1debb9
mm/swapfile.c: tmp is always smaller than max
...
If tmp is bigger or equal to max, we would jump to new_cluster.
Return true directly.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: "Huang, Ying" <ying.huang@intel.com >
Cc: Tim Chen <tim.c.chen@linux.intel.com >
Cc: Hugh Dickins <hughd@google.com >
Link: http://lkml.kernel.org/r/20200421213824.8099-2-richard.weiyang@gmail.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:09 -07:00
0fd0e19e4d
mm/swapfile.c: found_free could be represented by (tmp < max)
...
This is not necessary to use the variable found_free to record the status.
Just check tmp and max is enough.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: "Huang, Ying" <ying.huang@intel.com >
Cc: Tim Chen <tim.c.chen@linux.intel.com >
Cc: Hugh Dickins <hughd@google.com >
Link: http://lkml.kernel.org/r/20200421213824.8099-1-richard.weiyang@gmail.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:09 -07:00
abca1c84b7
mm/swapfile.c: remove the extra check in scan_swap_map_slots()
...
scan_swap_map_slots() is only called by scan_swap_map() and
get_swap_pages(). Both ensure nr would not exceed SWAP_BATCH.
Just remove it.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Cc: Hugh Dickins <hughd@google.com >
Link: http://lkml.kernel.org/r/20200325220309.9803-2-richard.weiyang@gmail.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:09 -07:00
08d3090fc8
mm/swapfile.c: simplify the calculation of n_goal
...
Use min3() to simplify the comparison and make it more self-explaining.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Andrew Morton <akpm@linux-foundation.org >
Cc: Hugh Dickins <hughd@google.com >
Link: http://lkml.kernel.org/r/20200325220309.9803-1-richard.weiyang@gmail.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:08 -07:00
bd2d18da4a
mm/swapfile.c: remove the unnecessary goto for SSD case
...
Now we can see there is redundant goto for SSD case. In these two places,
we can just let the code walk through to the correct tag instead of
explicitly jump to it.
Let's remove them for better readability.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Andrew Morton <akpm@linux-foundation.org >
Cc: Tim Chen <tim.c.chen@linux.intel.com >
Link: http://lkml.kernel.org/r/20200328060520.31449-4-richard.weiyang@gmail.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:08 -07:00
f4eaf51a72
mm/swapfile.c: explicitly show ssd/non-ssd is handled mutually exclusive
...
The code shows if this is ssd, it will jump to specific tag and skip the
following code for non-ssd.
Let's use "else if" to explicitly show the mutually exclusion for
ssd/non-ssd to reduce ambiguity.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Andrew Morton <akpm@linux-foundation.org >
Cc: Tim Chen <tim.c.chen@linux.intel.com >
Link: http://lkml.kernel.org/r/20200328060520.31449-3-richard.weiyang@gmail.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:08 -07:00
ca2c55a737
mm/swapfile.c: offset is only used when there is more slots
...
scan_swap_map_slots() is used to iterate swap_map[] array for an
available swap entry. While after several optimizations, e.g. for ssd
case, the logic of this function is a little not easy to catch.
This patchset tries to clean up the logic a little:
* shows the ssd/non-ssd case is handled mutually exclusively
* remove some unnecessary goto for ssd case
This patch (of 3):
When si->cluster_nr is zero, function would reach done and return. The
increased offset would not be used any more. This means we can move the
offset increment into the if clause.
This brings a further code cleanup possibility.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Andrew Morton <akpm@linux-foundation.org >
Cc: Tim Chen <tim.c.chen@linux.intel.com >
Link: http://lkml.kernel.org/r/20200328060520.31449-1-richard.weiyang@gmail.com
Link: http://lkml.kernel.org/r/20200328060520.31449-2-richard.weiyang@gmail.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:08 -07:00
ebc5951eea
mm: swap: properly update readahead statistics in unuse_pte_range()
...
In unuse_pte_range() we blindly swap-in pages without checking if the
swap entry is already present in the swap cache.
By doing this, the hit/miss ratio used by the swap readahead heuristic
is not properly updated and this leads to non-optimal performance during
swapoff.
Tracing the distribution of the readahead size returned by the swap
readahead heuristic during swapoff shows that a small readahead size is
used most of the time as if we had only misses (this happens both with
cluster and vma readahead), for example:
r::swapin_nr_pages(unsigned long offset):unsigned long:$retval
COUNT EVENT
36948 $retval = 8
44151 $retval = 4
49290 $retval = 1
527771 $retval = 2
Checking if the swap entry is present in the swap cache, instead, allows
to properly update the readahead statistics and the heuristic behaves in a
better way during swapoff, selecting a bigger readahead size:
r::swapin_nr_pages(unsigned long offset):unsigned long:$retval
COUNT EVENT
1618 $retval = 1
4960 $retval = 2
41315 $retval = 4
103521 $retval = 8
In terms of swapoff performance the result is the following:
Testing environment
===================
- Host:
CPU: 1.8GHz Intel Core i7-8565U (quad-core, 8MB cache)
HDD: PC401 NVMe SK hynix 512GB
MEM: 16GB
- Guest (kvm):
8GB of RAM
virtio block driver
16GB swap file on ext4 (/swapfile)
Test case
=========
- allocate 85% of memory
- `systemctl hibernate` to force all the pages to be swapped-out to the
swap file
- resume the system
- measure the time that swapoff takes to complete:
# /usr/bin/time swapoff /swapfile
Result (swapoff time)
======
5.6 vanilla 5.6 w/ this patch
----------- -----------------
cluster-readahead 22.09s 12.19s
vma-readahead 18.20s 15.33s
Conclusion
==========
The specific use case this patch is addressing is to improve swapoff
performance in cloud environments when a VM has been hibernated, resumed
and all the memory needs to be forced back to RAM by disabling swap.
This change allows to better exploits the advantages of the readahead
heuristic during swapoff and this improvement allows to to speed up the
resume process of such VMs.
[andrea.righi@canonical.com: update changelog]
Link: http://lkml.kernel.org/r/20200418084705.GA147642@xps-13
Signed-off-by: Andrea Righi <andrea.righi@canonical.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: "Huang, Ying" <ying.huang@intel.com >
Cc: Minchan Kim <minchan@kernel.org >
Cc: Anchal Agarwal <anchalag@amazon.com >
Cc: Hugh Dickins <hughd@google.com >
Cc: Vineeth Remanan Pillai <vpillai@digitalocean.com >
Cc: Kelley Nielsen <kelleynnn@gmail.com >
Link: http://lkml.kernel.org/r/20200416180132.GB3352@xps-13
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:08 -07:00
d6c1f098f2
mm/swap_state: fix a data race in swapin_nr_pages
...
"prev_offset" is a static variable in swapin_nr_pages() that can be
accessed concurrently with only mmap_sem held in read mode as noticed by
KCSAN,
BUG: KCSAN: data-race in swap_cluster_readahead / swap_cluster_readahead
write to 0xffffffff92763830 of 8 bytes by task 14795 on cpu 17:
swap_cluster_readahead+0x2a6/0x5e0
swapin_readahead+0x92/0x8dc
do_swap_page+0x49b/0xf20
__handle_mm_fault+0xcfb/0xd70
handle_mm_fault+0xfc/0x2f0
do_page_fault+0x263/0x715
page_fault+0x34/0x40
1 lock held by (dnf)/14795:
#0 : ffff897bd2e98858 (&mm->mmap_sem#2){++++}-{3:3}, at: do_page_fault+0x143/0x715
do_user_addr_fault at arch/x86/mm/fault.c:1405
(inlined by) do_page_fault at arch/x86/mm/fault.c:1535
irq event stamp: 83493
count_memcg_event_mm+0x1a6/0x270
count_memcg_event_mm+0x119/0x270
__do_softirq+0x365/0x589
irq_exit+0xa2/0xc0
read to 0xffffffff92763830 of 8 bytes by task 1 on cpu 22:
swap_cluster_readahead+0xfd/0x5e0
swapin_readahead+0x92/0x8dc
do_swap_page+0x49b/0xf20
__handle_mm_fault+0xcfb/0xd70
handle_mm_fault+0xfc/0x2f0
do_page_fault+0x263/0x715
page_fault+0x34/0x40
1 lock held by systemd/1:
#0 : ffff897c38f14858 (&mm->mmap_sem#2){++++}-{3:3}, at: do_page_fault+0x143/0x715
irq event stamp: 43530289
count_memcg_event_mm+0x1a6/0x270
count_memcg_event_mm+0x119/0x270
__do_softirq+0x365/0x589
irq_exit+0xa2/0xc0
Signed-off-by: Qian Cai <cai@lca.pw >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Cc: Marco Elver <elver@google.com >
Cc: Hugh Dickins <hughd@google.com >
Link: http://lkml.kernel.org/r/20200402213748.2237-1-cai@lca.pw
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:08 -07:00
213516ac07
mm/swapfile: use list_{prev,next}_entry() instead of open-coding
...
Use list_{prev,next}_entry() instead of list_entry() for better
code readability.
Signed-off-by: chenqiwu <chenqiwu@xiaomi.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Andrew Morton <akpm@linux-foundation.org >
Cc: Matthew Wilcox <willy@infradead.org >
Cc: David Hildenbrand <david@redhat.com >
Cc: Wei Yang <richard.weiyang@gmail.com >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Pankaj Gupta <pankaj.gupta.linux@gmail.com >
Cc: Yang Shi <yang.shi@linux.alibaba.com >
Cc: Qian Cai <cai@lca.pw >
Cc: Baoquan He <bhe@redhat.com >
Link: http://lkml.kernel.org/r/1586599916-15456-2-git-send-email-qiwuchen55@gmail.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:08 -07:00
548b6a1e55
mm/gup.c: further document vma_permits_fault()
...
Describe the caller's responsibilities when passing
FAULT_FLAG_ALLOW_RETRY.
Link: http://lkml.kernel.org/r/1586915606.5647.5.camel@mtkswgap22
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:08 -07:00
e792031019
ivtv: convert get_user_pages() --> pin_user_pages()
...
This code was using get_user_pages*(), in a "Case 2" scenario
(DMA/RDMA), using the categorization from [1]. That means that it's
time to convert the get_user_pages*() + put_page() calls to
pin_user_pages*() + unpin_user_pages() calls.
There is some helpful background in [2]: basically, this is a small part
of fixing a long-standing disconnect between pinning pages, and file
systems' use of those pages.
[1] Documentation/core-api/pin_user_pages.rst
[2] "Explicit pinning of user-space pages":
https://lwn.net/Articles/807108/
Signed-off-by: John Hubbard <jhubbard@nvidia.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Cc: Andy Walls <awalls@md.metrocast.net >
Cc: Mauro Carvalho Chehab <mchehab@kernel.org >
Link: http://lkml.kernel.org/r/20200518012157.1178336-3-jhubbard@nvidia.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:08 -07:00
9142902334
mm/gup: introduce pin_user_pages_unlocked
...
Introduce pin_user_pages_unlocked(), which is nearly identical to the
get_user_pages_unlocked() that it wraps, except that it sets FOLL_PIN
and rejects FOLL_GET.
Signed-off-by: John Hubbard <jhubbard@nvidia.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Andrew Morton <akpm@linux-foundation.org >
Cc: Andy Walls <awalls@md.metrocast.net >
Cc: Mauro Carvalho Chehab <mchehab@kernel.org >
Link: http://lkml.kernel.org/r/20200518012157.1178336-2-jhubbard@nvidia.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:08 -07:00
adc8cb406e
mm/gup.c: update the documentation
...
This patch is an attempt to update the documentation.
- Add/ remove extra * based on type of function static/global.
- Add description for functions and their input arguments.
[akpm@linux-foundation.org: s@/*@/**@]
Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/r/1588013630-4497-1-git-send-email-jrdr.linux@gmail.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:08 -07:00
8d92890bd6
mm/writeback: discard NR_UNSTABLE_NFS, use NR_WRITEBACK instead
...
After an NFS page has been written it is considered "unstable" until a
COMMIT request succeeds. If the COMMIT fails, the page will be
re-written.
These "unstable" pages are currently accounted as "reclaimable", either
in WB_RECLAIMABLE, or in NR_UNSTABLE_NFS which is included in a
'reclaimable' count. This might have made sense when sending the COMMIT
required a separate action by the VFS/MM (e.g. releasepage() used to
send a COMMIT). However now that all writes generated by ->writepages()
will automatically be followed by a COMMIT (since commit 919e3bd9a8
("NFS: Ensure we commit after writeback is complete")) it makes more
sense to treat them as writeback pages.
So this patch removes NR_UNSTABLE_NFS and accounts unstable pages in
NR_WRITEBACK and WB_WRITEBACK.
A particular effect of this change is that when
wb_check_background_flush() calls wb_over_bg_threshold(), the latter
will report 'true' a lot less often as the 'unstable' pages are no
longer considered 'dirty' (as there is nothing that writeback can do
about them anyway).
Currently wb_check_background_flush() will trigger writeback to NFS even
when there are relatively few dirty pages (if there are lots of unstable
pages), this can result in small writes going to the server (10s of
Kilobytes rather than a Megabyte) which hurts throughput. With this
patch, there are fewer writes which are each larger on average.
Where the NR_UNSTABLE_NFS count was included in statistics
virtual-files, the entry is retained, but the value is hard-coded as
zero. static trace points and warning printks which mentioned this
counter no longer report it.
[akpm@linux-foundation.org: re-layout comment]
[akpm@linux-foundation.org: fix printk warning]
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Acked-by: Michal Hocko <mhocko@suse.com> [mm]
Cc: Christoph Hellwig <hch@lst.de>
Cc: Chuck Lever <chuck.lever@oracle.com>
Link: http://lkml.kernel.org/r/87d06j7gqa.fsf@notabene.neil.brown.name
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:08 -07:00
a37b0715dd
mm/writeback: replace PF_LESS_THROTTLE with PF_LOCAL_THROTTLE
...
PF_LESS_THROTTLE exists for loop-back nfsd (and a similar need in the
loop block driver and callers of prctl(PR_SET_IO_FLUSHER)), where a
daemon needs to write to one bdi (the final bdi) in order to free up
writes queued to another bdi (the client bdi).
The daemon sets PF_LESS_THROTTLE and gets a larger allowance of dirty
pages, so that it can still dirty pages after other processses have been
throttled. The purpose of this is to avoid deadlock that happen when
the PF_LESS_THROTTLE process must write for any dirty pages to be freed,
but it is being thottled and cannot write.
This approach was designed when all threads were blocked equally,
independently on which device they were writing to, or how fast it was.
Since that time the writeback algorithm has changed substantially with
different threads getting different allowances based on non-trivial
heuristics. This means the simple "add 25%" heuristic is no longer
reliable.
The important issue is not that the daemon needs a *larger* dirty page
allowance, but that it needs a *private* dirty page allowance, so that
dirty pages for the "client" bdi that it is helping to clear (the bdi
for an NFS filesystem or loop block device etc) do not affect the
throttling of the daemon writing to the "final" bdi.
This patch changes the heuristic so that the task is not throttled when
the bdi it is writing to has a dirty page count below below (or equal
to) the free-run threshold for that bdi. This ensures it will always be
able to have some pages in flight, and so will not deadlock.
In a steady-state, it is expected that PF_LOCAL_THROTTLE tasks might
still be throttled by global threshold, but that is acceptable as it is
only the deadlock state that is interesting for this flag.
This approach of "only throttle when target bdi is busy" is consistent
with the other use of PF_LESS_THROTTLE in current_may_throttle(), were
it causes attention to be focussed only on the target bdi.
So this patch
- renames PF_LESS_THROTTLE to PF_LOCAL_THROTTLE,
- removes the 25% bonus that that flag gives, and
- If PF_LOCAL_THROTTLE is set, don't delay at all unless the
global and the local free-run thresholds are exceeded.
Note that previously realtime threads were treated the same as
PF_LESS_THROTTLE threads. This patch does *not* change the behvaiour
for real-time threads, so it is now different from the behaviour of nfsd
and loop tasks. I don't know what is wanted for realtime.
[akpm@linux-foundation.org: coding style fixes]
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Acked-by: Chuck Lever <chuck.lever@oracle.com> [nfsd]
Cc: Christoph Hellwig <hch@lst.de>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Trond Myklebust <trond.myklebust@hammerspace.com>
Link: http://lkml.kernel.org/r/87ftbf7gs3.fsf@notabene.neil.brown.name
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:08 -07:00
28659cc8cc
mm/page-writeback.c: remove unused variable
...
Commit 64081362e8 ("mm/page-writeback.c: fix range_cyclic writeback
vs writepages deadlock") left unused variable, remove it.
Signed-off-by: Chao Yu <yuchao0@huawei.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: David Hildenbrand <david@redhat.com >
Link: http://lkml.kernel.org/r/20200528033740.17269-1-yuchao0@huawei.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:08 -07:00
74f4c89d81
mm/filemap.c: remove misleading comment
...
We no longer return 0 here and the comment doesn't tell us anything that
we don't already know (SIGBUS is a pretty good indicator that things
didn't work out).
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: William Kucharski <william.kucharski@oracle.com >
Link: http://lkml.kernel.org/r/20200529123243.20640-1-willy@infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:08 -07:00
60e65a6f42
mm_types.h: change set_page_private to inline function
...
Change it to inline function to make callers use the proper argument. And
no need for it to be macro per Andrew's comment [1].
[1] https://lore.kernel.org/lkml/20200518221235.1fa32c38e5766113f78e3f0d@linux-foundation.org/
Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Andrew Morton <akpm@linux-foundation.org >
Link: http://lkml.kernel.org/r/20200525203149.18802-1-guoqing.jiang@cloud.ionos.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:08 -07:00
cd0f371544
mm/migrate.c: call detach_page_private to cleanup code
...
We can cleanup code a little by call detach_page_private here.
[akpm@linux-foundation.org: use attach_page_private(), per Dave]
http://lkml.kernel.org/r/20200521225220.GV2005@dread.disaster.area
[akpm@linux-foundation.org: clear PagePrivate]
Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Chao Yu <yuchao0@huawei.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Dave Chinner <dchinner@redhat.com>
Cc: Eric Biggers <ebiggers@google.com>
Cc: Gao Xiang <gaoxiang25@huawei.com>
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: Miklos Szeredi <mszeredi@redhat.com>
Link: http://lkml.kernel.org/r/20200519214049.15179-1-guoqing.jiang@cloud.ionos.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:08 -07:00
7b59435a2a
buffer_head.h: remove attach_page_buffers
...
All the callers have replaced attach_page_buffers with the new function
attach_page_private, so remove it.
Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Andrew Morton <akpm@linux-foundation.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de >
Cc: Roman Gushchin <guro@fb.com >
Cc: Andreas Dilger <adilger@dilger.ca >
Link: http://lkml.kernel.org/r/20200517214718.468-10-guoqing.jiang@cloud.ionos.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:08 -07:00
4c42be38c2
orangefs: use attach/detach_page_private
...
Since the new pair function is introduced, we can call them to clean the
code in orangefs.
Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Tested-by: Mike Marshall <hubcap@omnibond.com >
Reviewed-by: Andrew Morton <akpm@linux-foundation.org >
Cc: Martin Brandenburg <martin@omnibond.com >
Link: http://lkml.kernel.org/r/20200517214718.468-9-guoqing.jiang@cloud.ionos.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:08 -07:00
14ed109e3f
ntfs: replace attach_page_buffers with attach_page_private
...
Call the new function since attach_page_buffers will be removed.
Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Andrew Morton <akpm@linux-foundation.org >
Cc: Anton Altaparmakov <anton@tuxera.com >
Link: http://lkml.kernel.org/r/20200517214718.468-8-guoqing.jiang@cloud.ionos.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:07 -07:00
58aeb73196
iomap: use attach/detach_page_private
...
Since the new pair function is introduced, we can call them to clean the
code in iomap.
Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com >
Cc: Christoph Hellwig <hch@infradead.org >
Cc: Dave Chinner <david@fromorbit.com >
Link: http://lkml.kernel.org/r/20200517214718.468-7-guoqing.jiang@cloud.ionos.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:07 -07:00
7128cf9a25
f2fs: use attach/detach_page_private
...
Since the new pair function is introduced, we can call them to clean the
code in f2fs.h.
Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Acked-by: Chao Yu <yuchao0@huawei.com >
Cc: Jaegeuk Kim <jaegeuk@kernel.org >
Link: http://lkml.kernel.org/r/20200517214718.468-6-guoqing.jiang@cloud.ionos.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:07 -07:00
45dcfc2732
fs/buffer.c: use attach/detach_page_private
...
Since the new pair function is introduced, we can call them to clean the
code in buffer.c.
Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Andrew Morton <akpm@linux-foundation.org >
Cc: Alexander Viro <viro@zeniv.linux.org.uk >
Link: http://lkml.kernel.org/r/20200517214718.468-5-guoqing.jiang@cloud.ionos.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:07 -07:00
d1b89bc042
btrfs: use attach/detach_page_private
...
Since the new pair function is introduced, we can call them to clean the
code in btrfs.
Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Andrew Morton <akpm@linux-foundation.org >
Acked-by: David Sterba <dsterba@suse.com >
Cc: Chris Mason <clm@fb.com >
Cc: Josef Bacik <josef@toxicpanda.com >
Link: http://lkml.kernel.org/r/20200517214718.468-4-guoqing.jiang@cloud.ionos.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:07 -07:00
db2c1d86cc
md: remove __clear_page_buffers and use attach/detach_page_private
...
After introduction attach/detach_page_private in pagemap.h, we can remove
the duplicated code and call the new functions.
Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Acked-by: Song Liu <song@kernel.org >
Link: http://lkml.kernel.org/r/20200517214718.468-3-guoqing.jiang@cloud.ionos.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:07 -07:00
b03143accd
include/linux/pagemap.h: introduce attach/detach_page_private
...
Patch series "Introduce attach/detach_page_private to cleanup code".
This patch (of 10):
The logic in attach_page_buffers and __clear_page_buffers are quite
paired, but
1. they are located in different files.
2. attach_page_buffers is implemented in buffer_head.h, so it could be
used by other files. But __clear_page_buffers is static function in
buffer.c and other potential users can't call the function, md-bitmap
even copied the function.
So, introduce the new attach/detach_page_private to replace them. With
the new pair of function, we will remove the usage of attach_page_buffers
and __clear_page_buffers in next patches. Thanks for suggestions about
the function name from Alexander Viro, Andreas Grünbacher, Christoph
Hellwig and Matthew Wilcox.
Suggested-by: Matthew Wilcox <willy@infradead.org >
Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Andrew Morton <akpm@linux-foundation.org >
Cc: "Darrick J. Wong" <darrick.wong@oracle.com >
Cc: William Kucharski <william.kucharski@oracle.com >
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com >
Cc: Andreas Gruenbacher <agruenba@redhat.com >
Cc: Yang Shi <yang.shi@linux.alibaba.com >
Cc: Yafang Shao <laoar.shao@gmail.com >
Cc: Song Liu <song@kernel.org >
Cc: Chris Mason <clm@fb.com >
Cc: Josef Bacik <josef@toxicpanda.com >
Cc: David Sterba <dsterba@suse.com >
Cc: Alexander Viro <viro@zeniv.linux.org.uk >
Cc: Jaegeuk Kim <jaegeuk@kernel.org >
Cc: Chao Yu <chao@kernel.org >
Cc: Christoph Hellwig <hch@infradead.org >
Cc: Anton Altaparmakov <anton@tuxera.com >
Cc: Mike Marshall <hubcap@omnibond.com >
Cc: Martin Brandenburg <martin@omnibond.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de >
Cc: Roman Gushchin <guro@fb.com >
Cc: Andreas Dilger <adilger@dilger.ca >
Cc: Chao Yu <yuchao0@huawei.com >
Cc: Dave Chinner <david@fromorbit.com >
Link: http://lkml.kernel.org/r/20200517214718.468-1-guoqing.jiang@cloud.ionos.com
Link: http://lkml.kernel.org/r/20200517214718.468-2-guoqing.jiang@cloud.ionos.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:07 -07:00
9d24a13a93
iomap: convert from readpages to readahead
...
Use the new readahead operation in iomap. Convert XFS and ZoneFS to use
it.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com >
Reviewed-by: William Kucharski <william.kucharski@oracle.com >
Cc: Chao Yu <yuchao0@huawei.com >
Cc: Cong Wang <xiyou.wangcong@gmail.com >
Cc: Dave Chinner <dchinner@redhat.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: Gao Xiang <gaoxiang25@huawei.com >
Cc: Jaegeuk Kim <jaegeuk@kernel.org >
Cc: John Hubbard <jhubbard@nvidia.com >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Junxiao Bi <junxiao.bi@oracle.com >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Zi Yan <ziy@nvidia.com >
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Cc: Miklos Szeredi <mszeredi@redhat.com >
Link: http://lkml.kernel.org/r/20200414150233.24495-26-willy@infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:07 -07:00
76a0294eb1
fuse: convert from readpages to readahead
...
Implement the new readahead operation in fuse by using __readahead_batch()
to fill the array of pages in fuse_args_pages directly. This lets us
inline fuse_readpages_fill() into fuse_readahead().
[willy@infradead.org: build fix]
Link: http://lkml.kernel.org/r/20200415025938.GB5820@bombadil.infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Dave Chinner <dchinner@redhat.com >
Reviewed-by: William Kucharski <william.kucharski@oracle.com >
Acked-by: Miklos Szeredi <mszeredi@redhat.com >
Cc: Chao Yu <yuchao0@huawei.com >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Cong Wang <xiyou.wangcong@gmail.com >
Cc: Darrick J. Wong <darrick.wong@oracle.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: Gao Xiang <gaoxiang25@huawei.com >
Cc: Jaegeuk Kim <jaegeuk@kernel.org >
Cc: John Hubbard <jhubbard@nvidia.com >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Junxiao Bi <junxiao.bi@oracle.com >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Zi Yan <ziy@nvidia.com >
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Link: http://lkml.kernel.org/r/20200414150233.24495-25-willy@infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:07 -07:00
e20a769364
f2fs: pass the inode to f2fs_mpage_readpages
...
This function now only uses the mapping argument to look up the inode, and
both callers already have the inode, so just pass the inode instead of the
mapping.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: William Kucharski <william.kucharski@oracle.com >
Reviewed-by: Eric Biggers <ebiggers@google.com >
Reviewed-by: Chao Yu <yuchao0@huawei.com >
Acked-by: Jaegeuk Kim <jaegeuk@kernel.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Cong Wang <xiyou.wangcong@gmail.com >
Cc: Darrick J. Wong <darrick.wong@oracle.com >
Cc: Dave Chinner <dchinner@redhat.com >
Cc: Gao Xiang <gaoxiang25@huawei.com >
Cc: John Hubbard <jhubbard@nvidia.com >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Junxiao Bi <junxiao.bi@oracle.com >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Zi Yan <ziy@nvidia.com >
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Cc: Miklos Szeredi <mszeredi@redhat.com >
Link: http://lkml.kernel.org/r/20200414150233.24495-24-willy@infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:07 -07:00
2332319625
f2fs: convert from readpages to readahead
...
Use the new readahead operation in f2fs
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: William Kucharski <william.kucharski@oracle.com >
Reviewed-by: Eric Biggers <ebiggers@google.com >
Reviewed-by: Chao Yu <yuchao0@huawei.com >
Acked-by: Jaegeuk Kim <jaegeuk@kernel.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Cong Wang <xiyou.wangcong@gmail.com >
Cc: Darrick J. Wong <darrick.wong@oracle.com >
Cc: Dave Chinner <dchinner@redhat.com >
Cc: Gao Xiang <gaoxiang25@huawei.com >
Cc: John Hubbard <jhubbard@nvidia.com >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Junxiao Bi <junxiao.bi@oracle.com >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Zi Yan <ziy@nvidia.com >
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Cc: Miklos Szeredi <mszeredi@redhat.com >
Link: http://lkml.kernel.org/r/20200414150233.24495-23-willy@infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:07 -07:00
a07f624bd6
ext4: pass the inode to ext4_mpage_readpages
...
This function now only uses the mapping argument to look up the inode, and
both callers already have the inode, so just pass the inode instead of the
mapping.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: William Kucharski <william.kucharski@oracle.com >
Reviewed-by: Eric Biggers <ebiggers@google.com >
Cc: Chao Yu <yuchao0@huawei.com >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Cong Wang <xiyou.wangcong@gmail.com >
Cc: Darrick J. Wong <darrick.wong@oracle.com >
Cc: Dave Chinner <dchinner@redhat.com >
Cc: Gao Xiang <gaoxiang25@huawei.com >
Cc: Jaegeuk Kim <jaegeuk@kernel.org >
Cc: John Hubbard <jhubbard@nvidia.com >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Junxiao Bi <junxiao.bi@oracle.com >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Zi Yan <ziy@nvidia.com >
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Cc: Miklos Szeredi <mszeredi@redhat.com >
Link: http://lkml.kernel.org/r/20200414150233.24495-22-willy@infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:07 -07:00
6311f91f76
ext4: convert from readpages to readahead
...
Use the new readahead operation in ext4
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: William Kucharski <william.kucharski@oracle.com >
Reviewed-by: Eric Biggers <ebiggers@google.com >
Cc: Chao Yu <yuchao0@huawei.com >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Cong Wang <xiyou.wangcong@gmail.com >
Cc: Darrick J. Wong <darrick.wong@oracle.com >
Cc: Dave Chinner <dchinner@redhat.com >
Cc: Gao Xiang <gaoxiang25@huawei.com >
Cc: Jaegeuk Kim <jaegeuk@kernel.org >
Cc: John Hubbard <jhubbard@nvidia.com >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Junxiao Bi <junxiao.bi@oracle.com >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Zi Yan <ziy@nvidia.com >
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Cc: Miklos Szeredi <mszeredi@redhat.com >
Link: http://lkml.kernel.org/r/20200414150233.24495-21-willy@infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:07 -07:00
0615090c50
erofs: convert compressed files from readpages to readahead
...
Use the new readahead operation in erofs.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Dave Chinner <dchinner@redhat.com >
Reviewed-by: William Kucharski <william.kucharski@oracle.com >
Reviewed-by: Chao Yu <yuchao0@huawei.com >
Acked-by: Gao Xiang <gaoxiang25@huawei.com >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Cong Wang <xiyou.wangcong@gmail.com >
Cc: Darrick J. Wong <darrick.wong@oracle.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: Jaegeuk Kim <jaegeuk@kernel.org >
Cc: John Hubbard <jhubbard@nvidia.com >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Junxiao Bi <junxiao.bi@oracle.com >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Zi Yan <ziy@nvidia.com >
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Cc: Miklos Szeredi <mszeredi@redhat.com >
Link: http://lkml.kernel.org/r/20200414150233.24495-20-willy@infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:07 -07:00
0c07a9f91e
erofs: convert uncompressed files from readpages to readahead
...
Use the new readahead operation in erofs
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: William Kucharski <william.kucharski@oracle.com >
Reviewed-by: Chao Yu <yuchao0@huawei.com >
Acked-by: Gao Xiang <gaoxiang25@huawei.com >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Cong Wang <xiyou.wangcong@gmail.com >
Cc: Darrick J. Wong <darrick.wong@oracle.com >
Cc: Dave Chinner <dchinner@redhat.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: Jaegeuk Kim <jaegeuk@kernel.org >
Cc: John Hubbard <jhubbard@nvidia.com >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Junxiao Bi <junxiao.bi@oracle.com >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Zi Yan <ziy@nvidia.com >
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Cc: Miklos Szeredi <mszeredi@redhat.com >
Link: http://lkml.kernel.org/r/20200414150233.24495-19-willy@infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:07 -07:00
ba206a026f
btrfs: convert from readpages to readahead
...
Implement the new readahead method in btrfs using the new
readahead_page_batch() function.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: William Kucharski <william.kucharski@oracle.com >
Cc: Chao Yu <yuchao0@huawei.com >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Cong Wang <xiyou.wangcong@gmail.com >
Cc: Darrick J. Wong <darrick.wong@oracle.com >
Cc: Dave Chinner <dchinner@redhat.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: Gao Xiang <gaoxiang25@huawei.com >
Cc: Jaegeuk Kim <jaegeuk@kernel.org >
Cc: John Hubbard <jhubbard@nvidia.com >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Junxiao Bi <junxiao.bi@oracle.com >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Zi Yan <ziy@nvidia.com >
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Cc: Miklos Szeredi <mszeredi@redhat.com >
Link: http://lkml.kernel.org/r/20200414150233.24495-18-willy@infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:07 -07:00
d4388340ae
fs: convert mpage_readpages to mpage_readahead
...
Implement the new readahead aop and convert all callers (block_dev,
exfat, ext2, fat, gfs2, hpfs, isofs, jfs, nilfs2, ocfs2, omfs, qnx6,
reiserfs & udf).
The callers are all trivial except for GFS2 & OCFS2.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Junxiao Bi <junxiao.bi@oracle.com > # ocfs2
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com > # ocfs2
Reviewed-by: Dave Chinner <dchinner@redhat.com >
Reviewed-by: John Hubbard <jhubbard@nvidia.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: William Kucharski <william.kucharski@oracle.com >
Cc: Chao Yu <yuchao0@huawei.com >
Cc: Cong Wang <xiyou.wangcong@gmail.com >
Cc: Darrick J. Wong <darrick.wong@oracle.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: Gao Xiang <gaoxiang25@huawei.com >
Cc: Jaegeuk Kim <jaegeuk@kernel.org >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Zi Yan <ziy@nvidia.com >
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Cc: Miklos Szeredi <mszeredi@redhat.com >
Link: http://lkml.kernel.org/r/20200414150233.24495-17-willy@infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:07 -07:00
f2c817bed5
mm: use memalloc_nofs_save in readahead path
...
Ensure that memory allocations in the readahead path do not attempt to
reclaim file-backed pages, which could lead to a deadlock. It is
possible, though unlikely this is the root cause of a problem observed
by Cong Wang.
Reported-by: Cong Wang <xiyou.wangcong@gmail.com >
Suggested-by: Michal Hocko <mhocko@suse.com >
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: William Kucharski <william.kucharski@oracle.com >
Cc: Chao Yu <yuchao0@huawei.com >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Darrick J. Wong <darrick.wong@oracle.com >
Cc: Dave Chinner <dchinner@redhat.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: Gao Xiang <gaoxiang25@huawei.com >
Cc: Jaegeuk Kim <jaegeuk@kernel.org >
Cc: John Hubbard <jhubbard@nvidia.com >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Junxiao Bi <junxiao.bi@oracle.com >
Cc: Zi Yan <ziy@nvidia.com >
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Cc: Miklos Szeredi <mszeredi@redhat.com >
Link: http://lkml.kernel.org/r/20200414150233.24495-16-willy@infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:07 -07:00
2d8163e489
mm: document why we don't set PageReadahead
...
If the page is already in cache, we don't set PageReadahead on it.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: William Kucharski <william.kucharski@oracle.com >
Cc: Chao Yu <yuchao0@huawei.com >
Cc: Cong Wang <xiyou.wangcong@gmail.com >
Cc: Darrick J. Wong <darrick.wong@oracle.com >
Cc: Dave Chinner <dchinner@redhat.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: Gao Xiang <gaoxiang25@huawei.com >
Cc: Jaegeuk Kim <jaegeuk@kernel.org >
Cc: John Hubbard <jhubbard@nvidia.com >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Junxiao Bi <junxiao.bi@oracle.com >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Zi Yan <ziy@nvidia.com >
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Cc: Miklos Szeredi <mszeredi@redhat.com >
Link: http://lkml.kernel.org/r/20200414150233.24495-15-willy@infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:07 -07:00
2c684234d3
mm: add page_cache_readahead_unbounded
...
ext4 and f2fs have duplicated the guts of the readahead code so they can
read past i_size. Instead, separate out the guts of the readahead code
so they can call it directly.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Tested-by: Eric Biggers <ebiggers@google.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: William Kucharski <william.kucharski@oracle.com >
Reviewed-by: Eric Biggers <ebiggers@google.com >
Cc: Chao Yu <yuchao0@huawei.com >
Cc: Cong Wang <xiyou.wangcong@gmail.com >
Cc: Darrick J. Wong <darrick.wong@oracle.com >
Cc: Dave Chinner <dchinner@redhat.com >
Cc: Gao Xiang <gaoxiang25@huawei.com >
Cc: Jaegeuk Kim <jaegeuk@kernel.org >
Cc: John Hubbard <jhubbard@nvidia.com >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Junxiao Bi <junxiao.bi@oracle.com >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Zi Yan <ziy@nvidia.com >
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Cc: Miklos Szeredi <mszeredi@redhat.com >
Link: http://lkml.kernel.org/r/20200414150233.24495-14-willy@infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:06 -07:00
b0f31d78cb
mm: move end_index check out of readahead loop
...
By reducing nr_to_read, we can eliminate this check from inside the loop.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: John Hubbard <jhubbard@nvidia.com >
Reviewed-by: William Kucharski <william.kucharski@oracle.com >
Cc: Chao Yu <yuchao0@huawei.com >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Cong Wang <xiyou.wangcong@gmail.com >
Cc: Darrick J. Wong <darrick.wong@oracle.com >
Cc: Dave Chinner <dchinner@redhat.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: Gao Xiang <gaoxiang25@huawei.com >
Cc: Jaegeuk Kim <jaegeuk@kernel.org >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Junxiao Bi <junxiao.bi@oracle.com >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Zi Yan <ziy@nvidia.com >
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Cc: Miklos Szeredi <mszeredi@redhat.com >
Link: http://lkml.kernel.org/r/20200414150233.24495-13-willy@infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:06 -07:00
8151b4c8be
mm: add readahead address space operation
...
This replaces ->readpages with a saner interface:
- Return void instead of an ignored error code.
- Page cache is already populated with locked pages when ->readahead
is called.
- New arguments can be passed to the implementation without changing
all the filesystems that use a common helper function like
mpage_readahead().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: John Hubbard <jhubbard@nvidia.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: William Kucharski <william.kucharski@oracle.com >
Cc: Chao Yu <yuchao0@huawei.com >
Cc: Cong Wang <xiyou.wangcong@gmail.com >
Cc: Darrick J. Wong <darrick.wong@oracle.com >
Cc: Dave Chinner <dchinner@redhat.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: Gao Xiang <gaoxiang25@huawei.com >
Cc: Jaegeuk Kim <jaegeuk@kernel.org >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Junxiao Bi <junxiao.bi@oracle.com >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Zi Yan <ziy@nvidia.com >
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Cc: Miklos Szeredi <mszeredi@redhat.com >
Link: http://lkml.kernel.org/r/20200414150233.24495-12-willy@infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:06 -07:00
c1f6925e10
mm: put readahead pages in cache earlier
...
When populating the page cache for readahead, mappings that use
->readpages must populate the page cache themselves as the pages are
passed on a linked list which would normally be used for the page
cache's LRU. For mappings that use ->readpage or the upcoming
->readahead method, we can put the pages into the page cache as soon as
they're allocated, which solves a race between readahead and direct IO.
It also lets us remove the gfp argument from read_pages().
Use the new readahead_page() API to implement the repeated calls to
->readpage(), just like most filesystems will.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: William Kucharski <william.kucharski@oracle.com >
Cc: Chao Yu <yuchao0@huawei.com >
Cc: Cong Wang <xiyou.wangcong@gmail.com >
Cc: Darrick J. Wong <darrick.wong@oracle.com >
Cc: Dave Chinner <dchinner@redhat.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: Gao Xiang <gaoxiang25@huawei.com >
Cc: Jaegeuk Kim <jaegeuk@kernel.org >
Cc: John Hubbard <jhubbard@nvidia.com >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Junxiao Bi <junxiao.bi@oracle.com >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Zi Yan <ziy@nvidia.com >
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Cc: Miklos Szeredi <mszeredi@redhat.com >
Link: http://lkml.kernel.org/r/20200414150233.24495-11-willy@infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:06 -07:00
ef8153b609
mm: remove 'page_offset' from readahead loop
...
Replace the page_offset variable with 'index + i'.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: John Hubbard <jhubbard@nvidia.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: William Kucharski <william.kucharski@oracle.com >
Cc: Chao Yu <yuchao0@huawei.com >
Cc: Cong Wang <xiyou.wangcong@gmail.com >
Cc: Darrick J. Wong <darrick.wong@oracle.com >
Cc: Dave Chinner <dchinner@redhat.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: Gao Xiang <gaoxiang25@huawei.com >
Cc: Jaegeuk Kim <jaegeuk@kernel.org >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Junxiao Bi <junxiao.bi@oracle.com >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Zi Yan <ziy@nvidia.com >
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Cc: Miklos Szeredi <mszeredi@redhat.com >
Link: http://lkml.kernel.org/r/20200414150233.24495-10-willy@infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:06 -07:00
c2c7ad74b1
mm: rename readahead loop variable to 'i'
...
Change the type of page_idx to unsigned long, and rename it -- it's just
a loop counter, not a page index.
Suggested-by: John Hubbard <jhubbard@nvidia.com >
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Dave Chinner <dchinner@redhat.com >
Reviewed-by: William Kucharski <william.kucharski@oracle.com >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Cc: Chao Yu <yuchao0@huawei.com >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Cong Wang <xiyou.wangcong@gmail.com >
Cc: Darrick J. Wong <darrick.wong@oracle.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: Gao Xiang <gaoxiang25@huawei.com >
Cc: Jaegeuk Kim <jaegeuk@kernel.org >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Junxiao Bi <junxiao.bi@oracle.com >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Zi Yan <ziy@nvidia.com >
Cc: Miklos Szeredi <mszeredi@redhat.com >
Link: http://lkml.kernel.org/r/20200414150233.24495-9-willy@infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:06 -07:00
08eb9658ae
mm: rename various 'offset' parameters to 'index'
...
The word 'offset' is used ambiguously to mean 'byte offset within a
page', 'byte offset from the start of the file' and 'page offset from
the start of the file'.
Use 'index' to mean 'page offset from the start of the file' throughout
the readahead code.
[ We should probably rename the 'pgoff_t' type to 'pgidx_t' too - Linus ]
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Zi Yan <ziy@nvidia.com >
Reviewed-by: William Kucharski <william.kucharski@oracle.com >
Cc: Chao Yu <yuchao0@huawei.com >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Cong Wang <xiyou.wangcong@gmail.com >
Cc: Darrick J. Wong <darrick.wong@oracle.com >
Cc: Dave Chinner <dchinner@redhat.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: Gao Xiang <gaoxiang25@huawei.com >
Cc: Jaegeuk Kim <jaegeuk@kernel.org >
Cc: John Hubbard <jhubbard@nvidia.com >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Junxiao Bi <junxiao.bi@oracle.com >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Cc: Miklos Szeredi <mszeredi@redhat.com >
Link: http://lkml.kernel.org/r/20200414150233.24495-8-willy@infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:06 -07:00
a4d9653666
mm: use readahead_control to pass arguments
...
In this patch, only between __do_page_cache_readahead() and
read_pages(), but it will be extended in upcoming patches. The
read_pages() function becomes aops centric, as this makes the most sense
by the end of the patchset.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: John Hubbard <jhubbard@nvidia.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: William Kucharski <william.kucharski@oracle.com >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Cc: Chao Yu <yuchao0@huawei.com >
Cc: Cong Wang <xiyou.wangcong@gmail.com >
Cc: Darrick J. Wong <darrick.wong@oracle.com >
Cc: Dave Chinner <dchinner@redhat.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: Gao Xiang <gaoxiang25@huawei.com >
Cc: Jaegeuk Kim <jaegeuk@kernel.org >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Junxiao Bi <junxiao.bi@oracle.com >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Zi Yan <ziy@nvidia.com >
Cc: Miklos Szeredi <mszeredi@redhat.com >
Link: http://lkml.kernel.org/r/20200414150233.24495-7-willy@infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:06 -07:00
042124cc64
mm: add new readahead_control API
...
Filesystems which implement the upcoming ->readahead method will get
their pages by calling readahead_page() or readahead_page_batch().
These functions support large pages, even though none of the filesystems
to be converted do yet.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: William Kucharski <william.kucharski@oracle.com >
Cc: Chao Yu <yuchao0@huawei.com >
Cc: Cong Wang <xiyou.wangcong@gmail.com >
Cc: Darrick J. Wong <darrick.wong@oracle.com >
Cc: Dave Chinner <dchinner@redhat.com >
Cc: Eric Biggers <ebiggers@google.com >
Cc: Gao Xiang <gaoxiang25@huawei.com >
Cc: Jaegeuk Kim <jaegeuk@kernel.org >
Cc: John Hubbard <jhubbard@nvidia.com >
Cc: Joseph Qi <joseph.qi@linux.alibaba.com >
Cc: Junxiao Bi <junxiao.bi@oracle.com >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Zi Yan <ziy@nvidia.com >
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Cc: Miklos Szeredi <mszeredi@redhat.com >
Link: http://lkml.kernel.org/r/20200414150233.24495-6-willy@infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-02 10:59:06 -07:00