From patchwork Fri Nov 8 13:01:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Xinhai X-Patchwork-Id: 11234759 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7ED2E1390 for ; Fri, 8 Nov 2019 13:02:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4B08A2247D for ; Fri, 8 Nov 2019 13:02:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="uMXSi4YB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4B08A2247D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 820826B0005; Fri, 8 Nov 2019 08:02:25 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 77E106B0006; Fri, 8 Nov 2019 08:02:25 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 646D36B0007; Fri, 8 Nov 2019 08:02:25 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0127.hostedemail.com [216.40.44.127]) by kanga.kvack.org (Postfix) with ESMTP id 4B5F56B0005 for ; Fri, 8 Nov 2019 08:02:25 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 1589D2C8B for ; Fri, 8 Nov 2019 13:02:25 +0000 (UTC) X-FDA: 76133123850.12.slave17_1510e69485e40 X-Spam-Summary: 2,0,0,f521f363c854546d,d41d8cd98f00b204,lixinhai.lxh@gmail.com,:,RULES_HIT:41:69:355:379:541:988:989:1260:1345:1381:1437:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:2895:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3870:3871:3874:4250:5007:6261:6653:6755:7875:8660:9413:10004:11026:11473:11658:11914:12043:12219:12291:12296:12297:12438:12517:12519:12679:12683:12895:13069:13148:13230:13311:13357:14095:14096:14384:14394:14687:14721:21080:21444:21627:21666:21740:30012:30054:30070:30074:30091,0,RBL:209.85.128.67:@gmail.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: slave17_1510e69485e40 X-Filterd-Recvd-Size: 4138 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Fri, 8 Nov 2019 13:02:24 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id z19so6144685wmk.3 for ; Fri, 08 Nov 2019 05:02:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=Xp02jTzXdlvbZ9cMtn2KujcsDQGO37VOrcpuD+F2+Gw=; b=uMXSi4YBJxjQy667iBxcgVvEo/CP02CPYdWMlEqozZoZdFDut/Uj1KOktpMpGgbKHM 96+oxAYy95arAceEVbVmTSCOq3v0xlSGS7rnl3YiT/QUNWCVwWp937dQKPh/db6XsDJp WHKO3DqJGvCJHUCy6GLZw3JzGIdbdqqd/5BkRjMuG1jsyg/Ev50qSEteYZzHj33dtZAN O9rHSXJvKyUSPw8u24UH1nDdPq4CYF857tfnXHvP3Uf/5vzqMRSMmyzuIFBILyI92Vns 1P2QgIqj+vHkTRs8HVXyqC9k8QL+PdJgTBzb+adaK+ZvZKV04O3fq65rN3E09QUfP3Cu d9cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=Xp02jTzXdlvbZ9cMtn2KujcsDQGO37VOrcpuD+F2+Gw=; b=OSFT/V/ATJVEPrR3UvR8h0IrBziTmx4dnrln8zEoXpiUO+t3q1cLVmJLeT7Jt84IFM /q2kWKCdE4U7AKYQEt8sOJiMRcegRWdiMsC4ZdU8rRCsHnYPXzZG9VBEX0esHzg4fSyL U8YSdCb8yUxN+KDOBVCEafcOa84jEc5WfCfwnsrCEjY4e+7CAKfFLJ8ZVmjKxu29wRhk Wyk2YIuHcvmW65xnH9J1VPbEnFbmY6yd7VD468ig9CDJITANB9lrBjnARby6GYBQsuzb hsRa4a4EU9MC7zYLUrTwmXQ78Cw06z+8HPItpU23gxk5vkfJmU3elewpiSBnv9lHoK9g naUQ== X-Gm-Message-State: APjAAAV4awQ1OEEnqyL+dP7qeq+RV5cdAdzGyWD6Hn1bXOH15dkKeuKd 4tj1DBdchBStOj9Xz+jv1vwxzNdQ X-Google-Smtp-Source: APXvYqxaHlrnA/HkbrmqkPv5oJ7cE2EHCQ8e7lSkMkte9lR7mFT8x2RfKotvuI6p/g8SSrSOoOzLRQ== X-Received: by 2002:a1c:7d95:: with SMTP id y143mr8495218wmc.143.1573218143142; Fri, 08 Nov 2019 05:02:23 -0800 (PST) Received: from binjiang-hz-dhcp091254.china.nsn-net.net ([131.228.2.20]) by smtp.gmail.com with ESMTPSA id b8sm5873976wrt.39.2019.11.08.05.02.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Nov 2019 05:02:22 -0800 (PST) From: Li Xinhai To: linux-mm@kvack.org Subject: [PATCH v4 0/2] mm: Fix checking unmapped holes for mbind Date: Fri, 8 Nov 2019 21:01:42 +0800 Message-Id: <1573218104-11021-1-git-send-email-lixinhai.lxh@gmail.com> X-Mailer: git-send-email 1.8.3.1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000131, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This patchset fix checking unmapped holes for mbind(). First patch makes sure the vma been correctly tracked in .test_walk(), so each time when .test_walk() is called, the neighborhood of two vma is correct. Current problem is that the !vma_migratable() check could cause return immediately without update tracking to vma. Second patch fix the inconsistent report of EFAULT when mbind() is called for MPOL_DEFAULT and non MPOL_DEFAULT cases, so application do not need to have workaround code to handle this special behavior. Currently there are two problems, one is that the .test_walk() can not know there is hole at tail side of range, because .test_walk() only call for vma not for hole. The other one is that mbind_range() checks for hole at head side of range but do not consider the MPOL_MF_DISCONTIG_OK flag as done in .test_walk(). Changes v3->v4: - Split to two patch; - Illustrates the application visible behaviors in changelog; - Hole at tail side of range is checked in .test_walk(), not after walk page. Only the case for whole range in hole is checked after walk page, because our .test_walk() function would not be called at all in this case. Changes v2->v3: - Add more details in change log; - Check holes in .test_walk() and after call walk_page_range(); Li Xinhai (2): mm: Check range first in queue_pages_test_walk mm: Fix checking unmapped holes for mbind mm/mempolicy.c | 47 +++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 16 deletions(-)