Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1984027ybg; Fri, 5 Jun 2020 02:34:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxm96tBSP/V/8TEBhvVcmr1fkzl69Etpmt6Ki9PvA8jhIpsa4LurxWii5sqlLQZoaQ4ImxS X-Received: by 2002:aa7:c41a:: with SMTP id j26mr8553774edq.13.1591349643724; Fri, 05 Jun 2020 02:34:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591349643; cv=none; d=google.com; s=arc-20160816; b=Jm5KrI2Ku9B9i/fT9OphJlZWmnMR1t3EUl4wjg9ZrbOO3iI6nBRxniEVci1/oAm6Rj O/p9gp62ISJftRASDG2LjlLIHEZlkp27JVIv2KPgMt9JK/QoLSUoycyU3R7FNPaBgCKB cU8F+vlWPfL5tlOnx7GlmA8DoskPvvC94fX/F1El5lbUKYmS4yc22EecmVugX9jcWdD+ ltnyiWrQHJXfX75+VTgzKLlGolyT8zBN2zwHn8GoCUveY/LPLXeZeTNVN9F1X/h2pest aRapgasiblQfET2e9CfW0Oe4dpAb1MApOg4WVJcF1rGqDTMNPK0paa4OhRS6XsHuFm2n +wUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=NAWEqwQD/F5TIg0bPgl0uKs0kGQlTjN/ATKL4zcYsUY=; b=ASLK5Z8n56MV1mctSRS7ZNLPmsKEhB5FYbVrfxiPaT6wKNuH1u0eT5KXy5tgnnqH53 5MgJrbbgF4aRJpDM0j4H0mQgIKRZgk7z9Fa5LaTsJoqD1f0XdAe5zKGudK+PxZB4OqID CRNPVXkuU7HqXITqEv1eRHxozPVOsilPeU02IxdXBKQ4qCLRcn6+rrEWjBquo2HKNDSr gsRIhzQV/nDpRuSKRG9IiGHWTFiXYv6fbPVhxbABw57+VXbzCLhVYTEcOAIzXV8vqhX3 ytlZeKJivX2BVI/4nAM4iTK0CBFbkb4o1+JAnWRl+7y7+dmY52O2INY91SIWsKZ51lO8 RFQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Nwc67yJK; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g12si2187553edv.243.2020.06.05.02.33.39; Fri, 05 Jun 2020 02:34:03 -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=@gmail.com header.s=20161025 header.b=Nwc67yJK; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726665AbgFEJbo (ORCPT + 99 others); Fri, 5 Jun 2020 05:31:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726368AbgFEJbY (ORCPT ); Fri, 5 Jun 2020 05:31:24 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7541DC08C5C2 for ; Fri, 5 Jun 2020 02:31:24 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id y20so673013wmi.2 for ; Fri, 05 Jun 2020 02:31:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NAWEqwQD/F5TIg0bPgl0uKs0kGQlTjN/ATKL4zcYsUY=; b=Nwc67yJKdX9+1Qop0ErvOGkV+cGnmtPwvls0qkrXVjEC11iL63CnWkgWMJo9Tdj4T/ YPn1VNsQsFVPcZ9IGbuPYi2eS3BxJhoEtAWcqDJYvL/36xJ/Hjo67IqgwIxzuiFq64nO Rbtrq0ZFV3X+ZvYrfx3nxEdAWGGUvjxxSuT6sj/YF88RyxhFRZ2pPmpYWu8URT12MGBl vNSrF6Yq5z5cMZ/4TmqxoVJC5uB4NBvbOlTX0BD/3S9k+46P/uwo4u7iZE55w603a6QC ay24sCyvBcROAdiEkD7qKWpHmkXK2Zir9gyrREVSy6XHu7l0lCFuvK9OrQZxj5Bdfgh2 foow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NAWEqwQD/F5TIg0bPgl0uKs0kGQlTjN/ATKL4zcYsUY=; b=roHrUUbt+4khBgwtC1wATlQjDtCaa7FpYkDrG4bpERPtQNB7AFL6hjXhSlajmw4ZHm HKcq+VZy5pDLW6/Ule7d6M2U0u4uLyXdW+jjIUr+gXCL5iV3A48mBkKbQn+w4vknaiRi jIlbsOBIWysDZPypFi9NPXn55xNVLA64vb1yKuzGVo38iDPebSuOREc9tzN2srSv+ZXh py0PpUG+NIba9dcUT/TAIj62dI4SMiokxAYTH2uVhPNuyAsxP6PecBOl+07xkShvvIlo oBkebYvKoWdGIellZ6bYuhuUCC3NZPkNYzDZgALZraTA8CD+YgdA2nfGydW+xCjHauXk zPpw== X-Gm-Message-State: AOAM5313d5+uVKR4qeiBVlCHXyAmD/vc6u7Fe053qIbFdvKJ6Y2ByZEO +BNoFjFRYmkIe4i4nUV/2077voIJmy+F80PXp10= X-Received: by 2002:a7b:cbd9:: with SMTP id n25mr1791465wmi.30.1591349483211; Fri, 05 Jun 2020 02:31:23 -0700 (PDT) MIME-Version: 1.0 References: <20200605092502.18018-1-sjpark@amazon.com> <20200605092502.18018-2-sjpark@amazon.com> In-Reply-To: <20200605092502.18018-2-sjpark@amazon.com> From: Pankaj Gupta Date: Fri, 5 Jun 2020 11:31:12 +0200 Message-ID: Subject: Re: [PATCH 1/2] mm/page_idle.c: Skip offline pages To: SeongJae Park Cc: Andrew Morton , David Hildenbrand , Linux MM , LKML , SeongJae Park Content-Type: text/plain; charset="UTF-8" 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; Reviewed-by: Pankaj Gupta