From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751258AbdILFXF (ORCPT ); Tue, 12 Sep 2017 01:23:05 -0400 Received: from mga05.intel.com ([192.55.52.43]:8121 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750751AbdILFXE (ORCPT ); Tue, 12 Sep 2017 01:23:04 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,381,1500966000"; d="scan'208";a="127841830" From: "Huang\, Ying" To: Minchan Kim Cc: Andrew Morton , , , kernel-team , Ilya Dryomov , Sergey Senozhatsky , "Huang\, Ying" Subject: Re: [PATCH 4/5] mm:swap: respect page_cluster for readahead References: <1505183833-4739-1-git-send-email-minchan@kernel.org> <1505183833-4739-4-git-send-email-minchan@kernel.org> Date: Tue, 12 Sep 2017 13:23:01 +0800 In-Reply-To: <1505183833-4739-4-git-send-email-minchan@kernel.org> (Minchan Kim's message of "Tue, 12 Sep 2017 11:37:12 +0900") Message-ID: <87vakopk22.fsf@yhuang-dev.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Best Regards, Huang, Ying