From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4423DC3F2CD for ; Tue, 3 Mar 2020 06:19:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 10727215A4 for ; Tue, 3 Mar 2020 06:19:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 10727215A4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9BC156B0005; Tue, 3 Mar 2020 01:19:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 96E8D6B0006; Tue, 3 Mar 2020 01:19:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8829E6B0007; Tue, 3 Mar 2020 01:19:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0067.hostedemail.com [216.40.44.67]) by kanga.kvack.org (Postfix) with ESMTP id 6DD496B0005 for ; Tue, 3 Mar 2020 01:19:24 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 4B1B6181AC9CC for ; Tue, 3 Mar 2020 06:19:24 +0000 (UTC) X-FDA: 76553049048.14.sky31_34e6bd718c659 X-HE-Tag: sky31_34e6bd718c659 X-Filterd-Recvd-Size: 2708 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by imf42.hostedemail.com (Postfix) with ESMTP for ; Tue, 3 Mar 2020 06:19:23 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Mar 2020 22:19:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,510,1574150400"; d="scan'208";a="286888659" Received: from yhuang-dev.sh.intel.com (HELO yhuang-dev) ([10.239.159.23]) by FMSMGA003.fm.intel.com with ESMTP; 02 Mar 2020 22:19:19 -0800 From: "Huang\, Ying" To: Hugh Dickins Cc: Andrew Morton , , , Dave Hansen , David Hildenbrand , Mel Gorman , Vlastimil Babka , Zi Yan , Michal Hocko , Minchan Kim , Johannes Weiner Subject: Re: [PATCH] mm, migrate: Check return value of try_to_unmap() References: <20200303033645.280694-1-ying.huang@intel.com> Date: Tue, 03 Mar 2020 14:19:18 +0800 In-Reply-To: (Hugh Dickins's message of "Mon, 2 Mar 2020 22:11:45 -0800") Message-ID: <87blpe55ax.fsf@yhuang-dev.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi, Hugh, Hugh Dickins writes: >> diff --git a/mm/migrate.c b/mm/migrate.c >> index 3900044cfaa6..981f8374a6ef 100644 >> --- a/mm/migrate.c >> +++ b/mm/migrate.c >> @@ -1116,8 +1116,11 @@ static int __unmap_and_move(struct page *page, struct page *newpage, >> /* Establish migration ptes */ >> VM_BUG_ON_PAGE(PageAnon(page) && !PageKsm(page) && !anon_vma, >> page); >> - try_to_unmap(page, >> - TTU_MIGRATION|TTU_IGNORE_MLOCK|TTU_IGNORE_ACCESS); >> + if (!try_to_unmap(page, >> + TTU_MIGRATION|TTU_IGNORE_MLOCK|TTU_IGNORE_ACCESS)) { >> + rc = -EIO; >> + goto out_unlock_both; > > No: even if try_to_unmap() says that it did not entirely succeed, > it may have unmapped some ptes, inserting migration entries in their > place. Those need to be replaced by proper ptes before the page is > unlocked, which page_was_mapped 1 and remove_migration_ptes() do; > but this goto skips those. Yes. You are right. I misunderstand the original code. Please ignore this patch. Best Regards, Huang, Ying