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=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_SANE_1 autolearn=ham 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 6C98EC33CB1 for ; Wed, 15 Jan 2020 05:23:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 16F2524655 for ; Wed, 15 Jan 2020 05:23:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 16F2524655 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 975AD8E0005; Wed, 15 Jan 2020 00:23:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9257F8E0003; Wed, 15 Jan 2020 00:23:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 83BCE8E0005; Wed, 15 Jan 2020 00:23:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0075.hostedemail.com [216.40.44.75]) by kanga.kvack.org (Postfix) with ESMTP id 6DBB88E0003 for ; Wed, 15 Jan 2020 00:23:10 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 315A9180AD81D for ; Wed, 15 Jan 2020 05:23:10 +0000 (UTC) X-FDA: 76378724940.07.food41_72d99a1c81f4f X-HE-Tag: food41_72d99a1c81f4f X-Filterd-Recvd-Size: 4663 Received: from out30-45.freemail.mail.aliyun.com (out30-45.freemail.mail.aliyun.com [115.124.30.45]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Wed, 15 Jan 2020 05:23:08 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04427;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0TnmrdI6_1579065782; Received: from US-143344MP.local(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0TnmrdI6_1579065782) by smtp.aliyun-inc.com(127.0.0.1); Wed, 15 Jan 2020 13:23:05 +0800 Subject: Re: [PATCH 2/2] mm/mempolicy: Skip walking HUGETLB vma if MPOL_MF_STRICT is specified alone To: Mike Kravetz , Li Xinhai , "linux-mm@kvack.org" Cc: akpm , mhocko , n-horiguchi References: <1578993378-10860-1-git-send-email-lixinhai.lxh@gmail.com> <1578993378-10860-2-git-send-email-lixinhai.lxh@gmail.com> <2020011422092314671410@gmail.com> <7c26d332-c40a-0271-b408-a2079ab00808@linux.alibaba.com> From: Yang Shi Message-ID: <253e9110-4ffd-e9ba-feec-48ce899af057@linux.alibaba.com> Date: Tue, 14 Jan 2020 21:23:01 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US 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: On 1/14/20 8:28 PM, Mike Kravetz wrote: > On 1/14/20 5:24 PM, Yang Shi wrote: >> >> On 1/14/20 5:07 PM, Mike Kravetz wrote: >>> On 1/14/20 6:09 AM, Li Xinhai wrote: >>>> Add cc to >>>> Yang Shi >>>> Naoya Horiguchi >>>> , who has been worked on this part >>>> >>>> On 2020-01-14 at 17:16 Li Xinhai wrote: >>>>> Checking MPOL_MF_STRICT is ignored for HUGETLB vma according to mbind man >>>>> page: >>>>> >>>>> Notes >>>>> MPOL_MF_STRICT is ignored on huge page mappings. >>>>> >>>>> If MPOL_MF_STRICT is specified alone without any MOVE flag, we should >>>>> indicate, from test_walk, that walking this vma should be skipped even if >>>>> there are misplaced pages. >>>>> >>>>> Signed-off-by: Li Xinhai >>>>> Cc: Michal Hocko >>>>> Cc: Mike Kravetz >>> I do not necessarily disagree with the change. However, this has made me >>> question a couple things: >>> 1) Why does the man page say MPOL_MF_STRICT is ignored on huge page mappings? >>> - Is that leftover from the the days when huge page migration was not >>> supported? >>> - Is it just because huge page migration is more likely to fail than >>> base page migration. >>> 2) Does the mbind code function properly when unable to migrate a huge page >>> MPOL_MF_STRICT is set? A quick look at the code looks like it returns >>> EIO. >> I don't know the answer about question #1 I didn't dig into the history. The queue_pages_hugetlb() returns 0 unconditionally, I think this is what "MPOL_MF_STRICT is ignored on huge page mappings" means in code. >> >> It would return -EIO for base pages or THP as what the manpage describes. >> > I was thinking about a migration failure after isolation. This block of > code in do_mbind() after queue_pages_range() and mbind_range(). > > if (!err) { > int nr_failed = 0; > > if (!list_empty(&pagelist)) { > WARN_ON_ONCE(flags & MPOL_MF_LAZY); > nr_failed = migrate_pages(&pagelist, new_page, NULL, > start, MIGRATE_SYNC, MR_MEMPOLICY_MBIND); > if (nr_failed) > putback_movable_pages(&pagelist); > } > > if ((ret > 0) || (nr_failed && (flags & MPOL_MF_STRICT))) > err = -EIO; Hmm.. I agree this part in man page does look ambiguous. We may assume "MPOL_MF_STRICT is ignored on huge page mappings." implies if MPOL_MF_STRICT is specified alone? If MOVE flag is specified it should return -EIO if some pages could not be moved as what the man page describes. I don't know what the intention was at the first place. We may have to dig into the history. >