Message ID | 20240115102523.2336742-1-kernel@pankajraghav.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | readahead: use ilog2 instead of a while loop in page_cache_ra_order() | expand |
diff --git a/mm/readahead.c b/mm/readahead.c index c81234fa655a..18b23126eb52 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -500,10 +500,8 @@ void page_cache_ra_order(struct readahead_control *ractl, if (new_order < MAX_PAGECACHE_ORDER) { new_order += 2; - if (new_order > MAX_PAGECACHE_ORDER) - new_order = MAX_PAGECACHE_ORDER; - while ((1 << new_order) > ra->size) - new_order--; + new_order = min_t(unsigned int, MAX_PAGECACHE_ORDER, new_order); + new_order = min_t(unsigned int, new_order, ilog2(ra->size)); } filemap_invalidate_lock_shared(mapping);