Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp7235743ybp; Wed, 16 Oct 2019 05:56:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqyIrefT1n2T0psQlnxDH3wE0iG27qxtr2VJJ7AvHrD0eMz8Ka69FnZpP9E4Hqeaqz5Y2qcI X-Received: by 2002:a17:906:694d:: with SMTP id c13mr39524247ejs.146.1571230596380; Wed, 16 Oct 2019 05:56:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571230596; cv=none; d=google.com; s=arc-20160816; b=YyKBI00hORWvExl3zpMmy6TLPGk25YFkCaH2z0ezMVPmsN/eINx1p9gCu+iObMCR5u sdQlwhAJC1n85opmD4qSzRpDj1SrIEdT1hBb0FBkk/5/lIUVEL+d6B2A6mAHOh0vht6g N1a6O9b7aRF1iHW1ODkqeg5UPLJXjYBJWoKxVebaGD7x0KXWRT2wTzdTDgJaIxCFxuL9 6scOO00RHd4HA0SzHeS1krtlovwcji66taks6JDcFVuTWsrFses2l6u0a0FrIdbp6N5h ubPnszHnjJ1FyUrTfbb4OrSF/aFuEn5AiDNdym0qTCtzSeFSySxxRju/ZCdm9Pphtnuq oFsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=JS3VbVwBoUPjNhlv8rpRPPfQrB+9zBISyVFhCp6fSdg=; b=fWPs4wMU97bXRPrBk8DJzFZnD6GNfBHmHtWJDBIUxF67KLKYc2tbiQ3Nhp2hBNgp3g 6P4E3vroGCwd0dLKpAPIJXc0P+9C1HRa36K29RDlV6dghJdV/gRv5TKusNttJPOX/sBb ChSo5n3EQ06M2qyi/ET09/u85Ol3xG7nykkdXCrUGJlxWFj15Aw4xGNusUMAleMrrBF+ +9ihWi2b0ob5jhQiAaDRrn/MSpiWpmBLfRkMM7WMbr/+QqHuuIl1RHLLbR6CphrmvXOK nFSBViFyZuz05xS1Wf6aioYC/1D8txaYvoPMXTFYlMiB7Yp9OUD9rvGXvcH0U9c5xu4z LfSA== 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 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t10si17159913edd.447.2019.10.16.05.56.13; Wed, 16 Oct 2019 05:56:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390059AbfJPIe4 (ORCPT + 99 others); Wed, 16 Oct 2019 04:34:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59226 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728113AbfJPIey (ORCPT ); Wed, 16 Oct 2019 04:34:54 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B13CC8535C; Wed, 16 Oct 2019 08:34:54 +0000 (UTC) Received: from [10.36.117.237] (ovpn-117-237.ams2.redhat.com [10.36.117.237]) by smtp.corp.redhat.com (Postfix) with ESMTP id 78C195C1B5; Wed, 16 Oct 2019 08:34:53 +0000 (UTC) Subject: Re: [PATCH] mm, soft-offline: convert parameter to pfn To: Naoya Horiguchi Cc: "linux-mm@kvack.org" , Michal Hocko , Oscar Salvador , "linux-kernel@vger.kernel.org" , Andrew Morton References: <20191016070924.GA10178@hori.linux.bs1.fc.nec.co.jp> <20191016082735.GB13770@hori.linux.bs1.fc.nec.co.jp> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: Date: Wed, 16 Oct 2019 10:34:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 In-Reply-To: <20191016082735.GB13770@hori.linux.bs1.fc.nec.co.jp> Content-Type: text/plain; charset=iso-2022-jp; format=flowed; delsp=yes Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 16 Oct 2019 08:34:54 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16.10.19 10:27, Naoya Horiguchi wrote: > On Wed, Oct 16, 2019 at 09:56:19AM +0200, David Hildenbrand wrote: >> On 16.10.19 09:09, Naoya Horiguchi wrote: >>> Hi, >>> >>> I wrote a simple cleanup for parameter of soft_offline_page(), >>> based on thread https://lkml.org/lkml/2019/10/11/57. >>> >>> I know that we need more cleanup on hwpoison-inject, but I think >>> that will be mentioned in re-write patchset Oscar is preparing now. >>> So let me shared only this part as a separate one now. > ... >> >> I think you should rebase that patch on linux-next (where the >> pfn_to_online_page() check is in place). I assume you'll want to move the >> pfn_to_online_page() check into soft_offline_page() then as well? > > I rebased to next-20191016. And yes, we will move pfn_to_online_page() > into soft offline code. It seems that we can also move pfn_valid(), > but is simply moving like below good enough for you? At least I can't am the patch to current next/master (due to pfn_to_online_page()). > > @@ -1877,11 +1877,17 @@ static int soft_offline_free_page(struct page *page) > * This is not a 100% solution for all memory, but tries to be > * ``good enough'' for the majority of memory. > */ > -int soft_offline_page(struct page *page, int flags) > +int soft_offline_page(unsigned long pfn, int flags) > { > int ret; > - unsigned long pfn = page_to_pfn(page); > + struct page *page; > > + if (!pfn_valid(pfn)) > + return -ENXIO; > + /* Only online pages can be soft-offlined (esp., not ZONE_DEVICE). */ > + if (!pfn_to_online_page(pfn)) > + return -EIO; > + page = pfn_to_page(pfn); > if (is_zone_device_page(page)) { > pr_debug_ratelimited("soft_offline: %#lx page is device page\n", > pfn); > -- > > Or we might have an option to do as memory_failure() does like below: In contrast to soft offlining, memory failure can deal with devmem. So I think the above makes sense. -- Thanks, David / dhildenb