From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751266AbdILGZ2 (ORCPT ); Tue, 12 Sep 2017 02:25:28 -0400 Received: from LGEAMRELO13.lge.com ([156.147.23.53]:36621 "EHLO lgeamrelo13.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750911AbdILGZ2 (ORCPT ); Tue, 12 Sep 2017 02:25:28 -0400 X-Original-SENDERIP: 156.147.1.121 X-Original-MAILFROM: minchan@kernel.org X-Original-SENDERIP: 10.177.220.163 X-Original-MAILFROM: minchan@kernel.org Date: Tue, 12 Sep 2017 15:25:24 +0900 From: Minchan Kim To: "Huang, Ying" Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team , Ilya Dryomov , Sergey Senozhatsky Subject: Re: [PATCH 4/5] mm:swap: respect page_cluster for readahead Message-ID: <20170912062524.GA1950@bbox> References: <1505183833-4739-1-git-send-email-minchan@kernel.org> <1505183833-4739-4-git-send-email-minchan@kernel.org> <87vakopk22.fsf@yhuang-dev.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87vakopk22.fsf@yhuang-dev.intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 12, 2017 at 01:23:01PM +0800, Huang, Ying wrote: > Minchan Kim writes: > > > page_cluster 0 means "we don't want readahead" so in the case, > > let's skip the readahead detection logic. > > > > Cc: "Huang, Ying" > > Signed-off-by: Minchan Kim > > --- > > include/linux/swap.h | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/include/linux/swap.h b/include/linux/swap.h > > index 0f54b491e118..739d94397c47 100644 > > --- a/include/linux/swap.h > > +++ b/include/linux/swap.h > > @@ -427,7 +427,8 @@ extern bool has_usable_swap(void); > > > > static inline bool swap_use_vma_readahead(void) > > { > > - return READ_ONCE(swap_vma_readahead) && !atomic_read(&nr_rotate_swap); > > + return page_cluster > 0 && READ_ONCE(swap_vma_readahead) > > + && !atomic_read(&nr_rotate_swap); > > } > > > > /* Swap 50% full? Release swapcache more aggressively.. */ > > Now the readahead window size of the VMA based swap readahead is > controlled by /sys/kernel/mm/swap/vma_ra_max_order, while that of the > original swap readahead is controlled by sysctl page_cluster. It is > possible for anonymous memory to use VMA based swap readahead and tmpfs > to use original swap readahead algorithm at the same time. So that, I > think it is necessary to use different control knob to control these two > algorithm. So if we want to disable readahead for tmpfs, but keep it > for VMA based readahead, we can set 0 to page_cluster but non-zero to > /sys/kernel/mm/swap/vma_ra_max_order. With your change, this will be > impossible. For a long time, page-cluster have been used as controlling swap readahead. One of example, zram users have been disabled readahead via 0 page-cluster. However, with your change, it would be regressed if it doesn't disable vma_ra_max_order. As well, all of swap users should be aware of vma_ra_max_order as well as page-cluster to control swap readahead but I didn't see any document about that. Acutaully, I don't like it but want to unify it with page-cluster.