Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1980407ybg; Fri, 5 Jun 2020 02:28:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrhtOef/d3H0NbkmQrfSCuaPdCpd4Qbrt8oSpM3GDoa9iuVIcYRtMLFuScU+P89AmmmpVa X-Received: by 2002:a17:907:94ca:: with SMTP id dn10mr7603941ejc.348.1591349298891; Fri, 05 Jun 2020 02:28:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591349298; cv=none; d=google.com; s=arc-20160816; b=ltDVGk71CbVx2N9UhLCDa7TZmVm8/2G8xnrI/9GAooWeQdpiorAL6tavP0hmZvKCs8 nefxpzKqOObo+ZizGM+RGHyAzehGH7g5KWuENtjHtkDRL86R9HZlECyzrAs1G1nNlFmu h7oRWgAW1SnUxgQJrDzTli0SzJNcCoPqFVmgjTuE8U6TPffU8cjIHmQqFMamVnT87/uS g5zCsEORnP03MyV6vAAEwsxzYKFKSO2vTvMZST+XuGFe0f09/VLfCPbRGFvWbQKbx9YK rL6ps/CVdisj0E8sBXDRGUP0iG+XHWnurR+cMGwW9+h0p5BCoysx3q6w/F3JGM6/+6Pc I2fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:ironport-sdr:dkim-signature; bh=2WYBB4tJ65ci6WfpvKb1NLkX6q8yNQyc7qNwaxapXxQ=; b=kYJKTv1YfXuwIeNgjQ6VLSWQ+UtodW+p9y/XDZ8f/GMIdeWez+wYvd9iHLZhc36ciK JxeBD8ImJ6KSkhlAZtTYP9At6k2C0tLzAbhxA3RnNNLbIBgxLFIV8+LiFTleUNFFAQlX oJCSk6oXTEeG0rXCYVHhp3iAg32stAVsI62Yc+C3j4KYpUMre7fRPAglZg2KkGAAzvDN F0WtZp2YTYd4r4cm5M06wpW3icrqygabX9AqmJPzbbxj4SdFl7IcKZw9PlS46P6c+ze4 lDcbGxewnnPZ0q+UNb4oWb7mVYmRlFgFT50FXN0B0S2UF3wAbPV9HIxhcM6UKyb8nvaq U5rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=Lf5zWp9b; spf=pass (google.com: 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u21si3359524edq.299.2020.06.05.02.27.55; Fri, 05 Jun 2020 02:28:18 -0700 (PDT) Received-SPF: pass (google.com: 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; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=Lf5zWp9b; spf=pass (google.com: 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726270AbgFEJ0F (ORCPT + 99 others); Fri, 5 Jun 2020 05:26:05 -0400 Received: from smtp-fw-2101.amazon.com ([72.21.196.25]:6601 "EHLO smtp-fw-2101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726188AbgFEJ0E (ORCPT ); Fri, 5 Jun 2020 05:26:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1591349164; x=1622885164; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=2WYBB4tJ65ci6WfpvKb1NLkX6q8yNQyc7qNwaxapXxQ=; b=Lf5zWp9bkIfUII2ojfNzumAXHv30UviKuCVaitTz0k8gsy5vimJRV9Jb zA+fEVRqeyQSM0/UzVF8x+sthR4G0iwJNLwvv9LH0+IDCbMeyNY5OuKmI a8bCPb7h/pepSmPQAw6hq7iPb1XIcRz4MLNjIHJNjPqriOJYhkul+y73i s=; IronPort-SDR: sLgFbT17zN8xu0PccVFOh0/XP8F5DkdxKEahcNZsXW/JB8HaQfG0DM3P7xaj6T2aEDjzAHO6DN VwnBtOhiEpzw== X-IronPort-AV: E=Sophos;i="5.73,475,1583193600"; d="scan'208";a="34633948" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-1d-38ae4ad2.us-east-1.amazon.com) ([10.43.8.2]) by smtp-border-fw-out-2101.iad2.amazon.com with ESMTP; 05 Jun 2020 09:26:03 +0000 Received: from EX13MTAUEA002.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan3.iad.amazon.com [10.40.159.166]) by email-inbound-relay-1d-38ae4ad2.us-east-1.amazon.com (Postfix) with ESMTPS id C503EA1F10; Fri, 5 Jun 2020 09:26:01 +0000 (UTC) Received: from EX13D31EUA001.ant.amazon.com (10.43.165.15) by EX13MTAUEA002.ant.amazon.com (10.43.61.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 5 Jun 2020 09:25:45 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.162.200) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 5 Jun 2020 09:25:38 +0000 From: SeongJae Park To: CC: , , , SeongJae Park Subject: [PATCH 1/2] mm/page_idle.c: Skip offline pages Date: Fri, 5 Jun 2020 11:25:01 +0200 Message-ID: <20200605092502.18018-2-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605092502.18018-1-sjpark@amazon.com> References: <20200605092502.18018-1-sjpark@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.162.200] X-ClientProxiedBy: EX13D32UWB003.ant.amazon.com (10.43.161.220) To EX13D31EUA001.ant.amazon.com (10.43.165.15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: SeongJae Park 'Idle page tracking' users can pass random pfn that might be mapped to an offline page. To avoid accessing such pages, this commit modifies the 'page_idle_get_page()' to use 'pfn_to_online_page()' instead of 'pfn_valid()' and 'pfn_to_page()' combination, so that the pfn mapped to an offline page can be skipped. Signed-off-by: SeongJae Park Reported-by: David Hildenbrand --- mm/page_idle.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/mm/page_idle.c b/mm/page_idle.c index 295512465065..057c61df12db 100644 --- a/mm/page_idle.c +++ b/mm/page_idle.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -30,13 +31,9 @@ */ static struct page *page_idle_get_page(unsigned long pfn) { - struct page *page; + struct page *page = pfn_to_online_page(pfn); pg_data_t *pgdat; - if (!pfn_valid(pfn)) - return NULL; - - page = pfn_to_page(pfn); if (!page || !PageLRU(page) || !get_page_unless_zero(page)) return NULL; -- 2.17.1