Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp230952ybe; Wed, 4 Sep 2019 18:45:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxLtQs0QTQrZlsEwiuvAq3dFB4mBX41eQQRl+VgUyPJ53ZYka8ZIpPXm/ZClLVV6o/+Z1AZ X-Received: by 2002:a17:902:b686:: with SMTP id c6mr752222pls.87.1567647952440; Wed, 04 Sep 2019 18:45:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567647952; cv=none; d=google.com; s=arc-20160816; b=DVoV73e/BVKCoBQwTM6owAUSauVudtOozkuEGf95uDp6Nl+282+wAW2Qyzv6LcqroO +1GJAXpZbXV50Phjn0Pv8wS7qeC2Z/i50GKohK4Y8hoUDzaHP9iIBF+HAGq28cS6nBLY j+MHLtazPwyt/+oibXstW2StEvz3WfRN30/PAg1htZ/8ok51HToXUZMLdkZRAK8le7Pv G2fhn3S9qj38JTQxSvDJO1U+icblqvNsy6+mgAO+qE1xX9WPhaFep87RXpZPriVX8tb5 USxWn1y61nPNJbniD6LMu29EsR8kTBxUFRikMX/4RCiJK2U91p4oATMBkhHJ8QTXHjp+ 8UoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=Y1n7rOspACyeFlALvITOY0330o3WhFiPtRMs5O5uWJM=; b=fVD6tZOjprjmcCHd3FVKCnXYXf92oL80O+4I4Y7y8LrFht04Dn4Dcz1DImrE/Y5d7H Q0gY3D1xcjMtYDKdAiRYtAUC0qOgnx8vAZa59KPzr+sqMy02WaVMwo9QbCTHUy5w0++3 7QvwnkIpy1T+yb3S4CIBsYVOAPn5rHBTZtdugaVMPu0ZECkTynjRIjQtgq2mkrP/4klE sX6VW0NGOemdQEC7bDUrHbzXUxwqC8x/PjX2pCy0lJK8LjDnroFKIWUmmQ2w/QfQuPws 7s5TSkq6kTgs5VfhFZ1fVAoxybR5+J1OC5K6M6GrkyZ8JSPXUSsPnQca/GMT802R8dyc d/3Q== 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 z11si482079pfa.221.2019.09.04.18.45.36; Wed, 04 Sep 2019 18:45:52 -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 S1728072AbfIEBoR convert rfc822-to-8bit (ORCPT + 99 others); Wed, 4 Sep 2019 21:44:17 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:4413 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726240AbfIEBoR (ORCPT ); Wed, 4 Sep 2019 21:44:17 -0400 Received: from DGGEML404-HUB.china.huawei.com (unknown [172.30.72.54]) by Forcepoint Email with ESMTP id 95D609393C3ACEC10E7F; Thu, 5 Sep 2019 09:44:15 +0800 (CST) Received: from DGGEML512-MBX.china.huawei.com ([169.254.2.60]) by DGGEML404-HUB.china.huawei.com ([fe80::b177:a243:7a69:5ab8%31]) with mapi id 14.03.0439.000; Thu, 5 Sep 2019 09:44:13 +0800 From: sunqiuyang To: Michal Hocko 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 Thread-Topic: [PATCH 1/1] mm/migrate: fix list corruption in migration of non-LRU movable pages Thread-Index: AQHVYi7CKRiSaGuZ20KJAhdeZXNZ4qcZaW+AgAFf/lT//8LbAIAAjGWd//+OTACAAMgqDv//hZcAACt21AY= Date: Thu, 5 Sep 2019 01:44:12 +0000 Message-ID: <157FC541501A9C4C862B2F16FFE316DC190C5990@dggeml512-mbx.china.huawei.com> 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> In-Reply-To: <20190904125226.GV3838@dhcp22.suse.cz> Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.177.249.127] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ________________________________________ 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? --- -- Michal Hocko SUSE Labs