Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4275063ybb; Tue, 14 Apr 2020 04:10:12 -0700 (PDT) X-Google-Smtp-Source: APiQypJGyNtov/aOrXPWnVimXE+7VxIVZgX5x/MrSBO5ZrwMLCyhfq3jhJ5JQIRGSb7bYqRx/Aom X-Received: by 2002:aa7:d9c4:: with SMTP id v4mr4860972eds.342.1586862612756; Tue, 14 Apr 2020 04:10:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586862612; cv=none; d=google.com; s=arc-20160816; b=t4h/6bvnDpTkexl2B53NL9/iThWdmLbfp9CTl+Wc5x39DCcbxRzMgDIa8driL73qzW dEDfLq3bo18bOFb8Wmd7f3mmLop9c9qNBEpKBsh1JndbwSVr5VnMmIFuzm/OfO92/ttk fjN+z43ebKv22i9XbPff6SMPwG3OywVuE9LJjHIslvlwyOpsgJ1k/GprGpcBg3xqv15c 80Wtu74yW+XgPvXRSFCoypdKYA+ggGgmy699g8/Zz2byEYJm/2Kzkvf0HvT5S0erLj72 NCgpDr+1ZI0L3pM/tmxdr3ATAX4bAK+5ITNQhtetSs46M6zV8EURx1T+Aqji/YNZPMbB zsdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:ironport-sdr :ironport-sdr; bh=TDbHOjq0+nGY00dzeaX9zRL78x4GC1XyUIoP8tCVoJY=; b=lLBE/iNSPetDLSpVpHUjo40XP3bc8ham/JI3XGHg362SUhucvLOiGDdLIs2XCxy92B qPzrqhGeHopE71v/BFvJsbSj71VPwGmXFWNQEG4MXbw0LrPHliHi7SD2e9lEvfo/Tdgm 4AKyTm7FH7ChNPJF353Q+2u5mJmxamMWnkgRoS9/sNq1QI6iotX1RoNYDuzBS7oXjz68 Jh06834Vswzqdu6dhiaLA2lALEDJUNXBAxNFO5XoQJPvOXXP6HiItl8dZKuMED46AuUA stQh1nRMOVI5tEvlFq947L0UXaWrTVZEQSmnFd+tKb7RjqmDNBWIFKZOiackffH/hUh+ ceIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a15si56676edk.298.2020.04.14.04.09.48; Tue, 14 Apr 2020 04:10:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729721AbgDMNA7 (ORCPT + 99 others); Mon, 13 Apr 2020 09:00:59 -0400 Received: from mga09.intel.com ([134.134.136.24]:34510 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729674AbgDMNA6 (ORCPT ); Mon, 13 Apr 2020 09:00:58 -0400 IronPort-SDR: xUTCq/jWK495gEb4VBijUyTY8aPj2iJOJuQUdoN/HZ+34tKPaOuIVQ2HGt6FCOQshlqCZHKjhg cla48knxIq9g== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2020 06:00:56 -0700 IronPort-SDR: VIcIbSHG1U1ojTmjU3Gns1TngHKd+Zk0VvGgpSvkGn3lxcOsCA0rU12GeAo6KBY0vFeGJwlHhI opTS5Yg1g8/w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,378,1580803200"; d="scan'208";a="276896082" Received: from yhuang-dev.sh.intel.com (HELO yhuang-dev) ([10.239.159.23]) by fmsmga004.fm.intel.com with ESMTP; 13 Apr 2020 06:00:55 -0700 From: "Huang\, Ying" To: Andrea Righi Cc: Andrew Morton , Minchan Kim , Anchal Agarwal , , Subject: Re: [PATCH v2] mm: swap: use fixed-size readahead during swapoff References: <20200413111810.GA801367@xps-13> Date: Mon, 13 Apr 2020 21:00:34 +0800 In-Reply-To: <20200413111810.GA801367@xps-13> (Andrea Righi's message of "Mon, 13 Apr 2020 13:18:10 +0200") Message-ID: <87a73f7d71.fsf@yhuang-dev.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andrea Righi writes: [snip] > diff --git a/mm/swap_state.c b/mm/swap_state.c > index ebed37bbf7a3..c71abc8df304 100644 > --- a/mm/swap_state.c > +++ b/mm/swap_state.c > @@ -20,6 +20,7 @@ > #include > #include > #include > +#include > #include > > #include > @@ -507,6 +508,14 @@ static unsigned long swapin_nr_pages(unsigned long offset) > max_pages = 1 << READ_ONCE(page_cluster); > if (max_pages <= 1) > return 1; > + /* > + * If current task is using too much memory or swapoff is running > + * simply use the max readahead size. Since we likely want to load a > + * lot of pages back into memory, using a fixed-size max readhaead can > + * give better performance in this case. > + */ > + if (oom_task_origin(current)) > + return max_pages; > > hits = atomic_xchg(&swapin_readahead_hits, 0); > pages = __swapin_nr_pages(prev_offset, offset, hits, max_pages, Thinks this again. If my understanding were correct, the accessing pattern during swapoff is sequential, why swap readahead doesn't work? If so, can you root cause that firstly? Best Regards, Huang, Ying