Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3446125imu; Mon, 28 Jan 2019 05:07:33 -0800 (PST) X-Google-Smtp-Source: ALg8bN5bGDF4y0t5c8rpBo8suqGbSlien+gm9GE4HEl1dn4YPrNFdPlijQbOh9W/37OgcHbPzA97 X-Received: by 2002:a62:6503:: with SMTP id z3mr21213693pfb.169.1548680853394; Mon, 28 Jan 2019 05:07:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548680853; cv=none; d=google.com; s=arc-20160816; b=yUoAGDJkcTgFdGddWbLU9JMPzWtsKrDK5qduOnuR3PSlb629GPNZp9FIFFuLaCwWmu EdykmrWk5LuewZrMMikxtpG/12CVJFe3XvMnGUxd3Ien/zuZdY5Gf+R4JsqxYTh03dW9 kJN5XjC7GrmQe1839RqOjRC31JkhBwhboE3eK6ca0pKAK3rvdKeusXFp8qYrjp7t8gyH BBr7vbAtCB5Svf2cfEghznKn3DygAvnfCbMqreK/EjCX20jf71dnDvD5cyRPI9hPt/zE zLoJcA7p9S2fSoz4obKQIYqm+4IlCr1igO4fdpyW8cSVTTiwl8HGRos2F/CDIWxQ9SZb Dl7Q== 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=EuYAGBgS+z14Mv44r9n4zzz9EVkmOHaNicAihZrlOJs=; b=jZqrIVOiDO6gd+VzUsySNkIrecvnCVCT6YE/EOvl3xVbqeWzypT/mU0PEbtchr7UF5 sKyFQ+48fgPOqiDpO+FyDYMVPonW864T/S58WFyt6IlyTYI1wmk86QYX/MduduNZljIa YDzG8d4IHpsOilujqmcAUpGfqjHPCa5ip8LWEDpNvRKchWsiW/QfU68EEDizmLDwOlTT uQQEJgGU/Xk0nF5D37iNAuw88+ZJljwv+98zYlSB2ICdHl4sPNytwZY9xkdPGuVvGDgg mT3EvRTGcRLN+tFwJ0ZNwfqnPyjbSes7R4lE1h4L4WcnYqKTf2SUFP/OVLlJPOlozlrM MnHQ== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o7si32695554pgl.42.2019.01.28.05.07.17; Mon, 28 Jan 2019 05:07:33 -0800 (PST) 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726695AbfA1NHM (ORCPT + 99 others); Mon, 28 Jan 2019 08:07:12 -0500 Received: from mx2.suse.de ([195.135.220.15]:39808 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726661AbfA1NHL (ORCPT ); Mon, 28 Jan 2019 08:07:11 -0500 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 AD45DAC70; Mon, 28 Jan 2019 13:07:10 +0000 (UTC) Date: Mon, 28 Jan 2019 14:07:09 +0100 From: Michal Hocko To: David Hildenbrand Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Mel Gorman , "Kirill A. Shutemov" , Naoya Horiguchi , Jan Kara , Andrea Arcangeli , Dominik Brodowski , Matthew Wilcox , Vratislav Bendel , Rafael Aquini Subject: Re: [PATCH RFC] mm: migrate: don't rely on PageMovable() of newpage after unlocking it Message-ID: <20190128130709.GJ18811@dhcp22.suse.cz> References: <20190128121609.9528-1-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190128121609.9528-1-david@redhat.com> 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 Mon 28-01-19 13:16:09, David Hildenbrand wrote: [...] > My theory: > > In __unmap_and_move(), we lock the old and newpage and perform the > migration. In case of vitio-balloon, the new page will become > movable, the old page will no longer be movable. > > However, after unlocking newpage, I think there is nothing stopping > the newpage from getting dequeued and freed by virtio-balloon. This > will result in the newpage > 1. No longer having PageMovable() > 2. Getting moved to the local list before finally freeing it (using > page->lru) Does that mean that the virtio-balloon can change the Movable state while there are other users of the page? Can you point to the code that does it? How come this can be safe at all? Or is the PageMovable stable only under the page lock? -- Michal Hocko SUSE Labs