Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp199666pjb; Thu, 16 Jul 2020 11:48:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5VDIoPZd+BXytRqRPJrVt78xZutOGng8x6wde1OFt/x3ej9YCDmDV+mlxUtPEVSNNVmtv X-Received: by 2002:a17:906:3c46:: with SMTP id i6mr2708710ejg.66.1594925326383; Thu, 16 Jul 2020 11:48:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594925326; cv=none; d=google.com; s=arc-20160816; b=tzgUEq1RePcpDhrEFZeYNTa8Z/RRKh4lK76Ju96KSV8rmZy4DjkkMg+//XWEzzo7yN DIF9wRkFKbpSaZ92Lzcp93AIfPEhJI6UmmTEHDSEWe/eZ8IkLaNfYwIC/jWZs7NFgbtU GSxe/PAeuKj6YvDFle5vvBYBePf5AB7clJ1f4vk6TIrv91R94nyFzQHYfqiSgQ2wxGhB NSkO9B4P3rGaYhTXO3ge41GaAgFYqwOzg9VQh0NAImXbOWifdT8xpeM7JfzO9/HiTtJF NinnSpE2nOMYyn7gFVkWv9PI7T/+D4pWxr01TFR+BcBHRkX1QwV+kXKZIxAAFpbbAEwi 5KUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=JE7Pen46inwZxO9tkaTJDy3WUDLZxNVQfxoIMcr/BoM=; b=cyQIN1tVFgHqkkiUPcr3vqXWeANCjktdvg2pcp2J8hfTfZZGugOxhAhhBSt7qtCo+3 lpl6ZPOyGypbocSsm9KZTFVLWTwp2YEXnbknDzBQaQ6oX6VQIQ5xG1GEDenQLHg+lMt7 0pOZb1YRhm6dSNU09aiqwT6l2/PpGcsHD5rvJVATtij9EM2HXP82M7pHyHhFGQFOB+eF IBzi4beHd04eqnP5+fkMeoQB61bFjy4FGt2OYLC0AZiSZebHiCbNvcqMyDxtR4sEteKN O71YPpebuhkO6vDXGaFYBrjIV9RLZXdhsEgIO9XJAJAie8gpwoQrD9VGDKqelX3LfQgk 7VyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b="q5Zcz/RP"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h11si3554676eji.666.2020.07.16.11.48.23; Thu, 16 Jul 2020 11:48:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b="q5Zcz/RP"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728707AbgGPSrs (ORCPT + 99 others); Thu, 16 Jul 2020 14:47:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728374AbgGPSrr (ORCPT ); Thu, 16 Jul 2020 14:47:47 -0400 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC185C061755 for ; Thu, 16 Jul 2020 11:47:47 -0700 (PDT) Received: by mail-io1-xd44.google.com with SMTP id q74so7158867iod.1 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=mq1WCSkIGRzo1kltM+S5rqBuHl3h0xSHkcA2WNODD2tEjt5Um3pizgahMmdV1812So IhR2eQQG89ZkyKYOd34+96kqvqhz+gz53ZmvYUDnQ2ijDlsVw7M0MSEresOmxMD6n27a lSbz1aqxnUPYAxvEDJ2MG5KIlKCDF6ZM5MY8rzkqVYI82bAoYV4EC579LC15AFxVqC1H jQKrO8AFmuC4UQlSMu5N5mPEdG1ED3CTcOQCX2VMeJP4hYI7ETc9jxty15olmaR+fJbl 3stFnfpWQHrGTzrXob5FTb5V6mORoo41wuBmhGUYsli3rIBJRkEdbup5FsazdWHizEwq LQFg== X-Gm-Message-State: AOAM531xPBTUZJVSRLCBd4LQLxePfKqrXN7Zv+KSHONvlyYnIozZqjje 4nVpfaqmBohT3hfPMsH2cOodtcQV5dOaf5QVqzf/Qg== 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" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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