Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp3068764ybf; Mon, 2 Mar 2020 22:20:10 -0800 (PST) X-Google-Smtp-Source: ADFU+vsHZ5zYxC4JvpwCqPFsMsfHl3N/KQk2fm/v8aYZV3VLrl94k0oQ4iPIdlDeVPKx2TiCDWRq X-Received: by 2002:a9d:5e9:: with SMTP id 96mr2244129otd.307.1583216410700; Mon, 02 Mar 2020 22:20:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583216410; cv=none; d=google.com; s=arc-20160816; b=PU31vtEkAtHYUA949Fl1KvXqaLNua5XVMKgTzLeHohoYcMLusvJVucKRmtQeXSNrJs MfviycC3Y4pNn4JaJ8hAatwkIDQAqqOy5sQ4WMmIe5mz0Z5S7iNJBXfD11pHM1nGkloZ V0ONmFXxpQbh+/3K5EWgB2FE9VZscTzvSQyBBGJ15TBKllP+Ojufz1mNOSVYS29lPYlO qv7FnpbP7mVB3wF+RJjBLJFBkphyV64Jcp2U9Q8tqZ3Gn5TSXKgOosFBla+Mi9OCMLFl +7nRRU0UayrvR03S094PUh5yM2AP9R5BpcgWI+irwaLzqZ6n8akbmugjRNDlQwU1sFxq 1xFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=gg7klJXLCPC730ZnFQhPZWB5A2E0fU5dFJPSvIEJ/dA=; b=EISmrEr2CZ4s8jlJuzXxJ5kceIWNf4g2GuIoDrzU58NlicmrJpv8H6I58pX7F6c6O/ ZkFD1JvPz7XIn7ZTQpAIgG7HclARGEmWnUZZw69GBeqif08sdvF/4wYj6XeVhEU+CBmJ AZBZV6hudPrDUrHZCqY4DEHXUSwUpBxMQK9Mgh/lS4S9PZcgKZXUCs2D6YkrrBa2xv+U 8bH6XaDDUYACIiYfuN4oxyTCrCdpWgfGcKbfV9qxPTVpZD55WX0nKUD4UxiHromt9Fyg FGoKV2Zs8uF70JOwGZfpGIJX1sAGxUl5zILYRTXOa9eji0DI+bguiUz1yoVG91HCKcON FqxQ== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m85si7692486oig.158.2020.03.02.22.19.57; Mon, 02 Mar 2020 22:20:10 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725845AbgCCGTX (ORCPT + 99 others); Tue, 3 Mar 2020 01:19:23 -0500 Received: from mga06.intel.com ([134.134.136.31]:61509 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725554AbgCCGTW (ORCPT ); Tue, 3 Mar 2020 01:19:22 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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