Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4351973ybe; Mon, 9 Sep 2019 08:07:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqxUYhG7WWP0/+9Nl4vSfHbZdRZvcJAVNcGTSEyOxtBvURd0n2y1svDWN2RYlNBhGrd2cmON X-Received: by 2002:a50:ba0e:: with SMTP id g14mr25374810edc.241.1568041630525; Mon, 09 Sep 2019 08:07:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568041630; cv=none; d=google.com; s=arc-20160816; b=TCyNcvFkCSfdEmQNzj3uedSLLh3PctghdpKYMMLPD6eQoWhEe3PGqoCMuS7UsNUaVo uqcMTXFNNV8nIVPBMEym6Ltl0DBP+YNY2ZTkgdQimYHX94L90l8QWEn8Vz+GbX1NW6T0 bho7rF0oSosHdEnQQWTf5touaNBw4fd4p/MkusGvdBcPAIPgekIZlXa0PLnvyrJRm2bS rPrJjONgh/WoK0BJPctnrS4Z7tATdFmYTA6S3nh6hMLcwC5tn4ieCxi6vvkp15T6BskE Hqrud+COFLljM7ND6G6T45DYYvkcbWBfkAbQZpO2FS/5LX/ZQCfXr5VHSUJnqk0AxJ4I mxOg== 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=wgAtt8EgV7GuHXtyJZ22U6Q5VIr27Naq9OY0u7KxD5Q=; b=tY0pdataQWZocmI82UjaMuCik3X8+J2UgWlSupdZkXN9S4jvJMVGSY+JUoKexoq8rr VbOLWJYMudVBHnmqcKncp+bGBYwuL+gB2H8BiBS9R1IWfz/MWtpBxHbh0jLpcNdv90FL RC1pV7zVeQ7H88aAPWMwY/yP6KoL2WH0Sm7F+ElQCxfFzW99w486cpKCuallwwRgCfnv 8AxcYTMAiXm+E1qN3YH+KOoOr1OUA/aHCG1jQncsOGw0uiIl3xZrMnBDh1oeLcKSljdL yFprIim4cd2QUh43gYhSiFnOw09/k33y6hv6y8NPqyv7aP9xYBJdK0wJ4EpWuYMrPkfL 8Gjw== 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 y22si7528595ejr.99.2019.09.09.08.06.44; Mon, 09 Sep 2019 08:07:10 -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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389463AbfIIIkc (ORCPT + 99 others); Mon, 9 Sep 2019 04:40:32 -0400 Received: from mx2.suse.de ([195.135.220.15]:48794 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389418AbfIIIkc (ORCPT ); Mon, 9 Sep 2019 04:40:32 -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 8827BAFCC; Mon, 9 Sep 2019 08:40:30 +0000 (UTC) Date: Mon, 9 Sep 2019 10:40:29 +0200 From: Michal Hocko To: sunqiuyang , Minchan Kim Cc: "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" Subject: Re: [PATCH 1/1] mm/migrate: fix list corruption in migration of non-LRU movable pages Message-ID: <20190909084029.GE27159@dhcp22.suse.cz> References: <20190903082746.20736-1-sunqiuyang@huawei.com> <20190903131737.GB18939@dhcp22.suse.cz> <157FC541501A9C4C862B2F16FFE316DC190C1B09@dggeml512-mbx.china.huawei.com> <20190904063836.GD3838@dhcp22.suse.cz> <157FC541501A9C4C862B2F16FFE316DC190C2EBD@dggeml512-mbx.china.huawei.com> <20190904081408.GF3838@dhcp22.suse.cz> <157FC541501A9C4C862B2F16FFE316DC190C3402@dggeml512-mbx.china.huawei.com> <20190904125226.GV3838@dhcp22.suse.cz> <157FC541501A9C4C862B2F16FFE316DC190C5990@dggeml512-mbx.china.huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <157FC541501A9C4C862B2F16FFE316DC190C5990@dggeml512-mbx.china.huawei.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 Thu 05-09-19 01:44:12, sunqiuyang wrote: > > > > ________________________________________ > > From: Michal Hocko [mhocko@kernel.org] > > Sent: Wednesday, September 04, 2019 20:52 > > To: sunqiuyang > > Cc: linux-kernel@vger.kernel.org; linux-mm@kvack.org > > Subject: Re: [PATCH 1/1] mm/migrate: fix list corruption in migration of non-LRU movable pages > > > > On Wed 04-09-19 12:19:11, sunqiuyang wrote: > > > > Do not top post please > > > > > > > > On Wed 04-09-19 07:27:25, sunqiuyang wrote: > > > > > isolate_migratepages_block() from another thread may try to isolate the page again: > > > > > > > > > > for (; low_pfn < end_pfn; low_pfn++) { > > > > > /* ... */ > > > > > page = pfn_to_page(low_pfn); > > > > > /* ... */ > > > > > if (!PageLRU(page)) { > > > > > if (unlikely(__PageMovable(page)) && !PageIsolated(page)) { > > > > > /* ... */ > > > > > if (!isolate_movable_page(page, isolate_mode)) > > > > > goto isolate_success; > > > > > /*... */ > > > > > isolate_success: > > > > > list_add(&page->lru, &cc->migratepages); > > > > > > > > > > And this page will be added to another list. > > > > > Or, do you see any reason that the page cannot go through this path? > > > > > > > > The page shouldn't be __PageMovable after the migration is done. All the > > > > state should have been transfered to the new page IIUC. > > > > > > > > > > I don't see where page->mapping is modified after the migration is done. > > > > > > Actually, the last comment in move_to_new_page() says, > > > "Anonymous and movable page->mapping will be cleard by > > > free_pages_prepare so don't reset it here for keeping > > > the type to work PageAnon, for example. " > > > > > > Or did I miss something? Thanks, > > > > This talks about mapping rather than flags stored in the mapping. > > I can see that in tree migration handlers (z3fold_page_migrate, > > vmballoon_migratepage via balloon_page_delete, zs_page_migrate via > > reset_page) all reset the movable flag. I am not sure whether that is a > > documented requirement or just a coincidence. Maybe it should be > > documented. I would like to hear from Minchan. > > I checked the three migration handlers and only found __ClearPageMovable, > which clears registered address_space val with keeping PAGE_MAPPING_MOVABLE flag, > so the page should still be __PageMovable when caught by another migration thread. Right? Minchan, could you have a look at this please? I find __PageMovable semantic really awkward and I do not want to make misleading statements here. -- Michal Hocko SUSE Labs