Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp70807img; Tue, 19 Mar 2019 18:09:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqzxGDOZrtgK184V69yGSk2tTLujPtNclCP1UusbYPj/7oC52uCJHtnQ15/BYHoVtgzrvthB X-Received: by 2002:a17:902:20e3:: with SMTP id v32mr5043350plg.213.1553044149139; Tue, 19 Mar 2019 18:09:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553044149; cv=none; d=google.com; s=arc-20160816; b=Twca6jDdHHGEAYD+oIVToG1OMx6RJSrXf4oVo3A+g+TXh596lLSVMLGdDewIWUBpRa 0ehAw5JdFlcOB8QM5C3ls7qwfgIwhYuOjd5fPSm9YRJdSnqwa195kwN20UxTmbEA+ei4 6DsB2WE6GAoEcUUn2YhqisZ557i2MVYC+xyqBdHK7HyeFci7f7Sh0XUElgnTKUNsasid HzoMeV3zZ4iwdTdMcZ3lh3EqzQ6z2BhWVqx+SMlxjtQd2zTbTPgyPYeCiXT+eVog6F1E /8oCs/qVWpm06c8VcMFTk0ljcKyMWv8lLnBiJgeJLfqdCoVTePGyWYZD1qhGPIcB2+87 7CeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Xst49ofFZym2GBTG4vGswqMTlXQz7owvePCJT5IB0Cw=; b=QLZNNGi576+Nrfg8qNcrIDhOIrgV0MLEI4wwRuZM0SpXE9XNqkWzzybgOd1te2FNV2 gJ+xdWvfP1qPtMZukY37YELBmifdXlYzmFQdEzUBCmrwrVq1Q3qEVDFkWRBu7sI6f6zI HrZ2qnfqxXB+avRbBYCRxcWNJRmUuCUZh/3JQ+aGFgvavXue69bpxj1JlmEi0Xnu+9I6 Vm0wmm1rq/6kFeGTmdcZBx2tZ9Oe1sD+TdOs02U4S7tEEg9baUKxqURiEzgKoCNWMM6r pqf1IgE6Tzm3Qq95oyfW4pEFPt8ONDPqoRDOmf9+JWz6EBpdS2vNqu07aWfrbFCACeFR GbIg== 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=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e5si317713pgk.150.2019.03.19.18.08.53; Tue, 19 Mar 2019 18:09:09 -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=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727384AbfCTBGo (ORCPT + 99 others); Tue, 19 Mar 2019 21:06:44 -0400 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:51620 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727106AbfCTBGo (ORCPT ); Tue, 19 Mar 2019 21:06:44 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07488;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0TNA0mks_1553043988; Received: from US-143344MP.local(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0TNA0mks_1553043988) by smtp.aliyun-inc.com(127.0.0.1); Wed, 20 Mar 2019 09:06:30 +0800 Subject: Re: [PATCH] mm: mempolicy: make mbind() return -EIO when MPOL_MF_STRICT is specified To: David Rientjes Cc: chrubis@suse.cz, vbabka@suse.cz, kirill@shutemov.name, osalvador@suse.de, akpm@linux-foundation.org, stable@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <1553020556-38583-1-git-send-email-yang.shi@linux.alibaba.com> From: Yang Shi Message-ID: <5ef2a902-7abb-a0a9-f478-dcccbb393893@linux.alibaba.com> Date: Tue, 19 Mar 2019 18:06:26 -0700 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/19/19 5:49 PM, David Rientjes wrote: > On Wed, 20 Mar 2019, Yang Shi wrote: > >> When MPOL_MF_STRICT was specified and an existing page was already >> on a node that does not follow the policy, mbind() should return -EIO. >> But commit 6f4576e3687b ("mempolicy: apply page table walker on >> queue_pages_range()") broke the rule. >> >> And, commit c8633798497c ("mm: mempolicy: mbind and migrate_pages >> support thp migration") didn't return the correct value for THP mbind() >> too. >> >> If MPOL_MF_STRICT is set, ignore vma_migratable() to make sure it reaches >> queue_pages_to_pte_range() or queue_pages_pmd() to check if an existing >> page was already on a node that does not follow the policy. And, >> non-migratable vma may be used, return -EIO too if MPOL_MF_MOVE or >> MPOL_MF_MOVE_ALL was specified. >> >> Tested with https://github.com/metan-ucw/ltp/blob/master/testcases/kernel/syscalls/mbind/mbind02.c >> >> Fixes: 6f4576e3687b ("mempolicy: apply page table walker on queue_pages_range()") >> Reported-by: Cyril Hrubis >> Cc: Vlastimil Babka >> Cc: stable@vger.kernel.org >> Suggested-by: Kirill A. Shutemov >> Signed-off-by: Yang Shi >> Signed-off-by: Oscar Salvador > Acked-by: David Rientjes > > Thanks. I think this needs stable for 4.0+, can you confirm? Thanks. Yes, this needs stable for 4.0+. Yang