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=-9.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 2105AC388F7 for ; Sun, 25 Oct 2020 09:38:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 08AD422284 for ; Sun, 25 Oct 2020 09:38:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 08AD422284 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mail.si-head.nl Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3BF2C6B005D; Sun, 25 Oct 2020 05:38:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 371656B0062; Sun, 25 Oct 2020 05:38:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 239536B0068; Sun, 25 Oct 2020 05:38:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0192.hostedemail.com [216.40.44.192]) by kanga.kvack.org (Postfix) with ESMTP id ECD6E6B005D for ; Sun, 25 Oct 2020 05:38:18 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 7640B1EE6 for ; Sun, 25 Oct 2020 09:38:18 +0000 (UTC) X-FDA: 77409947076.27.mark37_1a0cb2327269 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 58F243D67F for ; Sun, 25 Oct 2020 09:38:18 +0000 (UTC) X-HE-Tag: mark37_1a0cb2327269 X-Filterd-Recvd-Size: 2257 Received: from mail.si-head.nl (si-head.tilaa.cloud [37.252.121.114]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Sun, 25 Oct 2020 09:38:17 +0000 (UTC) Received: from [IPv6:::1] (si-head.tilaa.cloud [37.252.121.114]) by mail.si-head.nl (Postfix) with ESMTPSA id 9C1A8C12A7; Sun, 25 Oct 2020 12:38:15 +0300 (MSK) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: [PATCH v2] mm/msync: exit early when the flags is an MS_ASYNC and start < vm_start From: Nikita Ermakov In-Reply-To: Date: Sun, 25 Oct 2020 12:38:14 +0300 Cc: linux-mm@kvack.org, Andrew Morton Content-Transfer-Encoding: quoted-printable Message-Id: <8CEEE660-0F22-4222-87D9-8DCA9D866029@mail.si-head.nl> References: <94E11FCB-AA03-490B-9F9E-2508DC8A15D1@mail.si-head.nl> <20201020205640.48257-1-sh1r4s3@mail.si-head.nl> To: Vlastimil Babka X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000077, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: > On 23 Oct 2020, at 14:12, Vlastimil Babka wrote: >=20 > On 10/20/20 10:56 PM, Nikita Ermakov wrote: >> If an unmapped region was found and the flag is MS_ASYNC (without >> MS_INVALIDATE) there is nothing to do and the result would be always >> -ENOMEM, so return immediately. >> Signed-off-by: Nikita Ermakov >> --- >> mm/msync.c | 2 ++ >> 1 file changed, 2 insertions(+) >> diff --git a/mm/msync.c b/mm/msync.c >> index 69c6d2029531..ed20c3621d4c 100644 >> --- a/mm/msync.c >> +++ b/mm/msync.c >> @@ -69,6 +69,8 @@ SYSCALL_DEFINE3(msync, unsigned long, start, = size_t, len, int, flags) >> goto out_unlock; >> /* Here start < vma->vm_end. */ >> if (start < vma->vm_start) { >=20 > I hoped it would become a code comment. >=20 Ops, I'm sorry. I've implemented this suggestion in the v3. >> + if (flags =3D=3D MS_ASYNC) >> + goto out_unlock; >> start =3D vma->vm_start; >> if (start >=3D end) >> goto out_unlock; >> base-commit: 6824a8a9b4861d7df7ee132a952bdf6f84a99cb8 -- Thanks, Nikita B8 00 4C CD 21