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=-4.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 4E36AC433E5 for ; Thu, 16 Jul 2020 18:47:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0800D2082E for ; Thu, 16 Jul 2020 18:47:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b="q5Zcz/RP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0800D2082E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5F26D6B008C; Thu, 16 Jul 2020 14:47:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5A32B8D0007; Thu, 16 Jul 2020 14:47:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 492D96B0093; Thu, 16 Jul 2020 14:47:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0184.hostedemail.com [216.40.44.184]) by kanga.kvack.org (Postfix) with ESMTP id 341846B008C for ; Thu, 16 Jul 2020 14:47:49 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 80431180AD804 for ; Thu, 16 Jul 2020 18:47:48 +0000 (UTC) X-FDA: 77044823016.16.party78_1e02e4026f04 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id 35F12100E6903 for ; Thu, 16 Jul 2020 18:47:48 +0000 (UTC) X-HE-Tag: party78_1e02e4026f04 X-Filterd-Recvd-Size: 4902 Received: from mail-io1-f67.google.com (mail-io1-f67.google.com [209.85.166.67]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Thu, 16 Jul 2020 18:47:47 +0000 (UTC) Received: by mail-io1-f67.google.com with SMTP id y2so7140390ioy.3 for ; Thu, 16 Jul 2020 11:47:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JE7Pen46inwZxO9tkaTJDy3WUDLZxNVQfxoIMcr/BoM=; b=q5Zcz/RPeQzCQ7zvA09TOSlqV6ksWSUtVb781iASamVNpGleTcjxA/JExhU+rexFaK hApORWXALbZ9CxyXvvHFTeNcOjxzkfe7d2tGfr0j4shRPSbk+ommynMq1fsA+9gtRuuD SghO4Ch7ivHSta+51v4KvYEJsVg37tVVpTT1s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JE7Pen46inwZxO9tkaTJDy3WUDLZxNVQfxoIMcr/BoM=; b=Zo504gAY6hSe9Gge68Uui9JkSs8zv8Q1ST79kGFohOaXQFH+kUO/AZ+ih5FdYuR69d Y4mXyARPpkUD2VGTX9FcINw1CxaDiGxcILDN/OWK2F4TXb7IlMVmXCYxyQwJuo2EpGh0 siLrzakaeJBnXFk+vEhOGdVy9sjFgBUFM+Xs0fYZtMB3uXtoib/sgNuNuHzIqIzIv9az vGddGuFKICcMm7TlIVU69hO5JV+CJGc0OrqIpzkqE4IY2jdTeNO2DG5IK6B8hzaNQtoN LGoNR9qIR7bqru+qveo8p3aJUix+V5pvPG5eo5c1scpjPqDaBvl/hnxHC4RzQ0xcm9Je d7ZA== X-Gm-Message-State: AOAM531E6Niov427f80log7NgTUSj9WjSyW1re1r6F9SgxMjc5R7Kix/ lNSTtUZhUeWXeOmbB0WL/GlyKhdhUpvQ904ZdfaiUA== X-Google-Smtp-Source: ABdhPJwajtXehTH2xCamwP/Z0zea0M1DJ8xsJRZ40e52TLDCiQieV6T9sHH/g0K/InHRuIK3CfDMNY9XQQMriZOOz6o= X-Received: by 2002:a05:6638:1450:: with SMTP id l16mr6872872jad.74.1594925267035; Thu, 16 Jul 2020 11:47:47 -0700 (PDT) MIME-Version: 1.0 References: <20200715135011.42743-1-kirill.shutemov@linux.intel.com> <20200715205428.GA201569@google.com> <20200715222228.jf2pv5u2wyhtc5o5@box> <20200716131612.b7ottczdgnxwdvrp@box> In-Reply-To: From: Joel Fernandes Date: Thu, 16 Jul 2020 14:47:35 -0400 Message-ID: Subject: Re: [PATCHv2] mm: Fix warning in move_normal_pmd() To: Linus Torvalds Cc: "Kirill A. Shutemov" , "Kirill A. Shutemov" , Andrew Morton , Linux-MM , Linux Kernel Mailing List , Naresh Kamboju , William Kucharski Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 35F12100E6903 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Jul 16, 2020 at 1:55 PM Linus Torvalds wrote: > > On Thu, Jul 16, 2020 at 6:16 AM Kirill A. Shutemov wrote: > > > > It can also lead to performance regression: for small mremap() if only one > > side of the range got aligned and there's no PMD_SIZE range to move, > > kernel will still iterate over PTEs, but it would need to handle more > > pte_none()s than without the patch. > > Ack, I've dropped the patch from my queue of experiments, because it > doesn't work for the case I wanted to do, and the other cases could > regress, as you say. > > Plus considering how many problems that patch had, I decided it wasn't > as simple as I initially thought it would be anyway ;) > > Joel - while it's gone from my mind, if you're still interested in > this, maybe you can do something _similar_ that patch, except perhaps > also start out checking that the initial size is large enough for this > to make sense even when one of the sides doesn't align, for example. > > (It might be as simple as checking that the initial 'len' is at least > PMD_SIZE - then you're guaranteed that whichever side gets aligned, > it's not doing extra work because the other side didn't). Hi Linus, Yes I'm quite interested in doing a similar patch and also adding some test cases to make sure it always works properly. Probably I can add some kselftest cases doing mremap on various ranges. I think it will be a great optimization to trigger the PMD move more often. I'll work on it and get back hopefully soon on this, Thanks! - Joel