Commit f615bfca468c9b80ed2d09be5fdbaf470a32c045
Committed by
Linus Torvalds
1 parent
46fc3e7b4e
Exists in
master
and in
4 other branches
readahead: MIN_RA_PAGES/MAX_RA_PAGES macros
Define two convenient macros for read-ahead: - MAX_RA_PAGES: rounded down counterpart of VM_MAX_READAHEAD - MIN_RA_PAGES: rounded _up_ counterpart of VM_MIN_READAHEAD Note that the rounded up MIN_RA_PAGES will work flawlessly with _large_ page sizes like 64k. Signed-off-by: Fengguang Wu <wfg@mail.ustc.edu.cn> Cc: Steven Pratt <slpratt@austin.ibm.com> Cc: Ram Pai <linuxram@us.ibm.com> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 10 additions and 2 deletions Side-by-side Diff
mm/readahead.c
... | ... | @@ -21,8 +21,16 @@ |
21 | 21 | } |
22 | 22 | EXPORT_SYMBOL(default_unplug_io_fn); |
23 | 23 | |
24 | +/* | |
25 | + * Convienent macros for min/max read-ahead pages. | |
26 | + * Note that MAX_RA_PAGES is rounded down, while MIN_RA_PAGES is rounded up. | |
27 | + * The latter is necessary for systems with large page size(i.e. 64k). | |
28 | + */ | |
29 | +#define MAX_RA_PAGES (VM_MAX_READAHEAD*1024 / PAGE_CACHE_SIZE) | |
30 | +#define MIN_RA_PAGES DIV_ROUND_UP(VM_MIN_READAHEAD*1024, PAGE_CACHE_SIZE) | |
31 | + | |
24 | 32 | struct backing_dev_info default_backing_dev_info = { |
25 | - .ra_pages = (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE, | |
33 | + .ra_pages = MAX_RA_PAGES, | |
26 | 34 | .state = 0, |
27 | 35 | .capabilities = BDI_CAP_MAP_COPY, |
28 | 36 | .unplug_io_fn = default_unplug_io_fn, |
... | ... | @@ -51,7 +59,7 @@ |
51 | 59 | |
52 | 60 | static inline unsigned long get_min_readahead(struct file_ra_state *ra) |
53 | 61 | { |
54 | - return (VM_MIN_READAHEAD * 1024) / PAGE_CACHE_SIZE; | |
62 | + return MIN_RA_PAGES; | |
55 | 63 | } |
56 | 64 | |
57 | 65 | static inline void reset_ahead_window(struct file_ra_state *ra) |