Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4316200ybb; Tue, 14 Apr 2020 05:02:25 -0700 (PDT) X-Google-Smtp-Source: APiQypIAJTDDHj8LgcnjlRuubi9mQK+izS2dhBqo5GJf6PnLZsrLXiqw9jM31HNcIluwFMMo8aYr X-Received: by 2002:a05:6402:2214:: with SMTP id cq20mr19464561edb.16.1586865745235; Tue, 14 Apr 2020 05:02:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586865745; cv=none; d=google.com; s=arc-20160816; b=Wl1bCiCdKHpscBFVLeJlV8WJ1iUPDgK9sHti+h7H/7VUpIEiKwXy9pHDMbMe1oU73E Y7Lm5IuoJM6nZceLyBpMJsDetUWiPLpPDnxG5UCHKbO75HPHvJ+AgXAB+pGJRqdUCLq0 RUFMhh1Xc+4SOXGWXtJ48KE0LtVu+nbk58xx7Mrkf3MoV/TTwajhXnwjQ9lIRdZvZKSQ H81WqncqNsEGG9za41Bg746lb/jS6HmFb2KHlxKSsOg6iKpfhfhDN9mjtvLlnJatmvbB R65HlLT3d+vYBp2e119MtPWAQnYmRU+EdrEnXvmAzrCH7GmuFwET7RKZlSwKeA5zCm0w 9gfQ== 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=/8SyiIi3e7jaAPpDdibEZBGTd7CI1ESkzUUd6P+8+W0=; b=U8GZxps8sscPoHAPeJZkb5H1XjO63G4EuU3zIh8YfCEdoThOTkDxkl9ApMIgubiW5T ZF+QySabXmK7/rAYAuTYObWfG15rxj+AdDcFCHSOvYJ0KRFQXxNHQRAQFAlY2zwXkhAI xuizJN8GQb7dE7vMQMlMgzsDNiG7XgPyqmLMlZifINl/VFCR4BjCj3jU4m6COalryEYA anMulng9M8Ac/10pPeOGHb0PvgUWSCOJBZKurZHWMuOInRyKa1SiWfkFSz4Mlbl2j61B UX/WdjWpqShE1wbfajhz0yTuOctvMEQLUXw36XPsFfr1bzJqsNV/NZ8uPbzbxfMmRdsQ eyiQ== 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 o8si8035426ejn.51.2020.04.14.05.02.01; Tue, 14 Apr 2020 05:02:25 -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 S1729784AbgDMNNi (ORCPT + 99 others); Mon, 13 Apr 2020 09:13:38 -0400 Received: from mga02.intel.com ([134.134.136.20]:45768 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728750AbgDMNNg (ORCPT ); Mon, 13 Apr 2020 09:13:36 -0400 IronPort-SDR: niPVWaW2RkcRfRqeeUygZIHkyiZDaStXBQD3OHnQ3oUOEs39NVonbUjucnIy2ftT/4+3JceP09 rrLxn4B8IvnA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2020 06:13:35 -0700 IronPort-SDR: EBarXwOJVuLuIhZVVqFQ5Ln6ll8U7Rpxf8g0h9ogMC3BvyKdu46ZUNzdUW5NOpgy6c7bXX4gTX 0FE9zkRtP9Gw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,378,1580803200"; d="scan'208";a="399603024" Received: from yhuang-dev.sh.intel.com (HELO yhuang-dev) ([10.239.159.23]) by orsmga004.jf.intel.com with ESMTP; 13 Apr 2020 06:13:34 -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:13:33 +0800 In-Reply-To: <20200413111810.GA801367@xps-13> (Andrea Righi's message of "Mon, 13 Apr 2020 13:18:10 +0200") Message-ID: <875ze37cle.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: > The global swap-in readahead policy takes in account the previous access > patterns, using a scaling heuristic to determine the optimal readahead > chunk dynamically. > > This works pretty well in most cases, but like any heuristic there are > specific cases when this approach is not ideal, for example the swapoff > scenario. > > During swapoff we just want to load back into memory all the swapped-out > pages and for this specific use case a fixed-size readahead is more > efficient. > > The specific use case this patch is addressing is to improve swapoff > performance when a VM has been hibernated, resumed and all memory needs > to be forced back to RAM by disabling swap (see the test case below). Why do you need to swapoff after resuming? The swap device isn't used except hibernation? I guess the process is, 1) add swap device to VM 2) hibernate 3) resume 4) swapoff Some pages are swapped out in step 2? If os, can we just set /proc/sys/vm/swappiness to 0 to avoid swapping in step 2? Best Regards, Huang, Ying