Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4234641ybg; Mon, 21 Oct 2019 06:01:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6466jWZQ8vk2RSjmM0ExsDUGgaYjJrqQZskzAhFEnfSrZWmb+B3iEQQWU1XWOV8l/eRLY X-Received: by 2002:aa7:cd71:: with SMTP id ca17mr3451231edb.1.1571662913529; Mon, 21 Oct 2019 06:01:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571662913; cv=none; d=google.com; s=arc-20160816; b=0MmriCS0mhyFwziFdiDlic4klMcVi6NmAoiT85kpDCodu/bds6btEE9yRHS3EctpRH oE0jy5mPjn7LU7GDxcuFJI2pHXqMe9djhxbCLLT7UVoDtHugPIka/CXx7X9pMioMTXQg 6RmcwvYxZjfyMJASeUOEg9ZFDw/Rd1tpNVFiCfOIKrTZ20DnXf35z6mW6zMJ7Xow8DAZ DvIW5aQlAcMXhDplDmmIf+H3nAmrns70uQeaTATip8jtwGr82KiG6AcywxNYJb2fB2KU vpUnspZuMHuFi99GPWpSp6szj1cU/T7OvDS3FJ2o3xSV/csAOvH1EGjVk6HJVGTpwX9y il8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=zW3XkNerU19XWDYgOPbq4Hy0sHoVo0g2gurh+qmCvE0=; b=OEWEf2JTl7s8qO1fFQh/L3PEAu743n/lssG0sdaHkFfTpSWSASSBIqjq4HSCBPRsIN DQuIZIAWs2CohcpQwCuEnruq6wAAjV7xdXJC6XGW3lXEZsTXh57sQIoHd6rH7ibcFa27 zhKgEH7L5MrfrhDZN1yi4mtz0nToluaSE4cvW7GrPYAcTi4BMnrjGoNg69HVxmt1iXva 2mRhd78bbxw1y1uIVwxEGhdE2CmlXr7SVyBwoKv1cFHoCpveNpbZvFAJVPvf/lipYT1y ovKOo8P0LQ2DUJVSeexPFexj+D7ZK7/z0a3CDRW1dY6EHUTKgIu+2QQrzyTcqpB4go8d 85Zw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h12si1116100ejd.17.2019.10.21.06.01.25; Mon, 21 Oct 2019 06:01:53 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728811AbfJUM6y (ORCPT + 99 others); Mon, 21 Oct 2019 08:58:54 -0400 Received: from mx2.suse.de ([195.135.220.15]:58546 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728081AbfJUM6x (ORCPT ); Mon, 21 Oct 2019 08:58:53 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 433A8AC18; Mon, 21 Oct 2019 12:58:52 +0000 (UTC) Date: Mon, 21 Oct 2019 14:58:49 +0200 From: Oscar Salvador To: Michal Hocko Cc: n-horiguchi@ah.jp.nec.com, mike.kravetz@oracle.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v2 10/16] mm,hwpoison: Rework soft offline for free pages Message-ID: <20191021125842.GA11330@linux> References: <20191017142123.24245-1-osalvador@suse.de> <20191017142123.24245-11-osalvador@suse.de> <20191018120615.GM5017@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191018120615.GM5017@dhcp22.suse.cz> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 18, 2019 at 02:06:15PM +0200, Michal Hocko wrote: > On Thu 17-10-19 16:21:17, Oscar Salvador wrote: > [...] > > +bool take_page_off_buddy(struct page *page) > > + { > > + struct zone *zone = page_zone(page); > > + unsigned long pfn = page_to_pfn(page); > > + unsigned long flags; > > + unsigned int order; > > + bool ret = false; > > + > > + spin_lock_irqsave(&zone->lock, flags); > > What prevents the page to be allocated in the meantime? Also what about > free pages on the pcp lists? Also the page could be gone by the time you > have reached here. Nothing prevents the page to be allocated in the meantime. We would just bail out and return -EBUSY to userspace. Since we do not do __anything__ to the page until we are sure we took it off, and it is completely isolated from the memory, there is no danger. Since soft-offline is kinda "best effort" mode, it is something like: "Sorry, could not poison the page, try again". Now, thinking about this a bit more, I guess we could be more clever here and call the routine that handles in-use pages if we see that the page was allocated by the time we reach take_page_off_buddy. About pcp pages, you are right. I thought that we were already handling that case, and we do, but looking closer the call to shake_page() (that among other things spills pcppages into buddy) is performed at a later stage. I think we need to adjust __get_any_page to recognize pcp pages as well. I will do some work here. Thanks for comments. -- Oscar Salvador SUSE L3