Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp315428ybl; Fri, 23 Aug 2019 01:03:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+KQXpvYy6WjuhkmWJLYcF/mXh4fU/ZlY9hliPSZ0ZKox9AjfouiCyArPrMfWWJcEObsf2 X-Received: by 2002:a62:e401:: with SMTP id r1mr3823109pfh.193.1566547411093; Fri, 23 Aug 2019 01:03:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566547411; cv=none; d=google.com; s=arc-20160816; b=FvC2kNAT9idhc5Wh7jy7ls/Baz8di/qk9e72156iA5S41gX0ObMsnBp/v/Q+7jfwE/ wNObG54MNb4hzx+mhjTrhIbqVukHFQqz+cLXNMO+9Qkp1colcBm1uNVGewSzfg/YdWvR hGWR1+iL69euyB8A084ESEzC485edVyRUtHRln61HuWddwuUAgnOGQImrRbrGyyVA3YS NFlJXHbRxJGHMx/icnNVUowbJrjj+dG8NzfwIsoYNH1Z1+3x56uF8ExHGXc9k7Kie09R Rsturp78R0GptkkOjCXK7F5xPQONZDswQzCFIADm63f8weETte6LXp4AJXvoi6UZkaFM 0gNA== 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=DzzTZzNkI7zV82e37gNp8wJsL5VSFkKIKsTyscFR6Tw=; b=Cm5R2xVEW7EPATHY4kJn6NioURcCBUR5cKPrH1bOa0/liKGjhv/7l/9R7EiXVaPZ2p tQkidX+SYWy+XiQ+8NSk2/kuWSHEO40ZuQqI+jKhhjfkDLD8LIh6YdbGIBFTNlP1aZwn M+ment1MONI5zm3Jzf1NiI9sf+W2TbMkJqbCYsDJzy7nRRS79eGvv6xAaXRnHXRUdwej KNy8vYRlKPc9P+vM/X8rQFwXYYB1RcBIb0bSePBjwJ8k4ldMTK4Y1TkWLmcfd8y1MWdw oIH4vUY6q1iL73NU2WvR/lmamgsrEcYKtS5u8QOiVznbij4ENkLHSABFLaoX5gfryOkR F2Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=PqcGQimE; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o19si1380649pgj.120.2019.08.23.01.03.15; Fri, 23 Aug 2019 01:03:31 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=PqcGQimE; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389269AbfHVUY3 (ORCPT + 99 others); Thu, 22 Aug 2019 16:24:29 -0400 Received: from mail-vs1-f68.google.com ([209.85.217.68]:46194 "EHLO mail-vs1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388453AbfHVUY2 (ORCPT ); Thu, 22 Aug 2019 16:24:28 -0400 Received: by mail-vs1-f68.google.com with SMTP id x20so4501910vsx.13 for ; Thu, 22 Aug 2019 13:24:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DzzTZzNkI7zV82e37gNp8wJsL5VSFkKIKsTyscFR6Tw=; b=PqcGQimE75OmNZ5Ta81LevfkQwVCZPgSClh1IEqtFe9OA/99yXwvxa/tq+r/MVe06y ttuw9ifAvWw5d6kiAK3Li5qglS2KzIlImd6uC3dsOtVL7ADqqP2Evw/en3aMazYKdwYJ np+afo0/w6idFS9yUDId2JTKACZ1qd/r3+RiJywE6S0vyIsbQkdZ7b8qm1V2uU+gayPA j2G+BkL/zzJ7/C4WIzdkl03PFQrsrzAEkNXPRcKNN81nEJokenvh4p/zX2QfLw27TYL6 sMeCkCaBOS4Qgt6p80Xl0gfruKsLVJ47s2ZOmY/t603idGGS1zO/V2G4cu0ona9zVrs0 BFOA== 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=DzzTZzNkI7zV82e37gNp8wJsL5VSFkKIKsTyscFR6Tw=; b=nKRXcj8y1iBQ/xKllAUBegIYwE0QmfhKh18vVxC6lIJa7huOfFvkCWlfQLjFUj+vRM awpm7N+oddlRKwIUdJGkIN6O5vjhvc1VJnejHQWVLn3yMGW4rc1KTTG36PAAsH90hkf1 rxzafm2gxWyW7m3zCyfqaWj4Q5qLMA/gExQel9V6LItuVrDdsefPKT0DpY/YiuCjLcux sJk6CkjKXPvI3FDgy2efWBczyBpLHsWjq4LpK12uuo79o6fKYktodK74rGAZQCknfCzg YmcMlycqrGx4fACY+O4pM/UO9rLfngdu26Vyad30iBJbXtBvmm/fdk5pGP4UxPjlFazp 3/cQ== X-Gm-Message-State: APjAAAUcHxFs5O2b0N5oezQ1+cvhoF6Ye138AVyNQQMXMXGMRFnJdkxf VQfSLzVFKpskbH+zORIqSBt7XhlpMvduL18yA0nFhQ== X-Received: by 2002:a67:be15:: with SMTP id x21mr670078vsq.142.1566505467495; Thu, 22 Aug 2019 13:24:27 -0700 (PDT) MIME-Version: 1.0 References: <20190813224620.31005-1-dave@stgolabs.net> <20190813224620.31005-2-dave@stgolabs.net> <20190821215707.GA99147@google.com> <20190822044936.qusm5zgjdf6n5fds@linux-r8p5> In-Reply-To: <20190822044936.qusm5zgjdf6n5fds@linux-r8p5> From: Michel Lespinasse Date: Thu, 22 Aug 2019 13:24:15 -0700 Message-ID: Subject: Re: [PATCH 1/3] x86,mm/pat: Use generic interval trees To: Davidlohr Bueso Cc: Ingo Molnar , Thomas Gleixner , Peter Zijlstra , Andrew Morton , x86@kernel.org, LKML , Davidlohr Bueso 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 Wed, Aug 21, 2019 at 9:49 PM Davidlohr Bueso wrote: > On Wed, 21 Aug 2019, Michel Lespinasse wrote: > >I'm not sure where to go with this - would it make sense to add a new > >interval tree header file that uses [start,end) intervals (with the > >thought of eventually converting all current interval tree users to it) > >instead of adding one more use of the less-natural [start,last] > >interval trees ? > > It might be the safest way, although I really hate having another > header file for interval_tree... The following is a diffstat of a > tentative conversion (I'll send the patch separately); I'm not sure > if a single shot conversion would be acceptable, albeit with relevant > maintainer acks. That would make sense to me. Maybe doing it all in a single commit is too hard to review or bisect, but having a small series that duplicates the interval tree header at the start and removes the old (closed intervals) version at the end looks like it would work IMO. > >At first, I thought that you were handling that by removing 1 from the > >end of the interval, to adjust between the PAT and interval tree > >definitions. But, I don't see you doing that anywhere. > > This should have been my first approach. > > >Then, I thought that you were using [start, end( intervals everywhere, > >and the interval tree functions memtype_interval_iter_first and > >memtype_interval_iter_next would just return too many candidate > >matches as as you are passing "end" instead of "last" == end-1 as the > >interval endpoint, but then you would filter out the extra intervals > >using is_node_overlap(). But, if that is the case, then I don't > >understand why you need to redefine is_node_overlap() here. > > My original expectation was to actually remove a lot more of pat_rbtree, > including the is_node_overlap() and the filtering. Yes, I think this can > be done if the interval-tree is converted to [a,b[ and we can thus > just iterate the tree seamlessly. All right. So, my preference would be if we can use a version of interval trees that would work natively with half open intervals, as we discussed above. But, if that seems like too much change, I would also be ready to approve a version of pat_interval.c that would adjust the interval endpoint to compensate for the interval tree's use of closed intervals. I think either way, I can't approve the current version as it's too much of an in-between which makes it hard to follow IMO. > I think doing the conversion you suggested to [a,b[ for all users, then > redoing this series on top of that would be the way to move forward. That would be ideal; hopefully you don't see the vma_interval_tree thing as blocking this approach ? Thanks, -- Michel "Walken" Lespinasse A program is never fully debugged until the last user dies.