From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by kanga.kvack.org (Postfix) with ESMTP id F1B836B000A for ; Fri, 5 Oct 2018 08:11:54 -0400 (EDT) Received: by mail-lj1-f198.google.com with SMTP id z9-v6so4614231ljz.4 for ; Fri, 05 Oct 2018 05:11:54 -0700 (PDT) Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id m78-v6sor2744112lfi.8.2018.10.05.05.11.52 for (Google Transport Security); Fri, 05 Oct 2018 05:11:52 -0700 (PDT) MIME-Version: 1.0 References: <20181003185854.GA1174@jordon-HP-15-Notebook-PC> <20181003200003.GA9965@bombadil.infradead.org> <20181003221444.GZ30658@n2100.armlinux.org.uk> <20181004123400.GC30658@n2100.armlinux.org.uk> <20181004181736.GB20842@bombadil.infradead.org> In-Reply-To: From: Souptick Joarder Date: Fri, 5 Oct 2018 17:41:39 +0530 Message-ID: Subject: Re: [PATCH v2] mm: Introduce new function vm_insert_kmem_page Content-Type: text/plain; charset="UTF-8" Sender: owner-linux-mm@kvack.org List-ID: To: Miguel Ojeda Cc: Matthew Wilcox , Russell King - ARM Linux , robin@protonic.nl, stefanr@s5r6.in-berlin.de, hjc@rock-chips.com, Heiko Stuebner , airlied@linux.ie, robin.murphy@arm.com, iamjoonsoo.kim@lge.com, Andrew Morton , Marek Szyprowski , Kees Cook , treding@nvidia.com, Michal Hocko , Dan Williams , "Kirill A. Shutemov" , Mark Rutland , aryabinin@virtuozzo.com, Dmitry Vyukov , Kate Stewart , tchibo@google.com, riel@redhat.com, Minchan Kim , Peter Zijlstra , "Huang, Ying" , ak@linux.intel.com, rppt@linux.vnet.ibm.com, linux@dominikbrodowski.net, Arnd Bergmann , cpandya@codeaurora.org, hannes@cmpxchg.org, Joe Perches , mcgrof@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux1394-devel@lists.sourceforge.net, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, Linux-MM On Fri, Oct 5, 2018 at 4:19 PM Miguel Ojeda wrote: > > Hi Souptick, > > On Fri, Oct 5, 2018 at 12:01 PM Souptick Joarder wrote: > > > > The final goal is to remove vm_insert_page by converting it to > > vmf_insert_page. But to do that we have to first introduce the > > new API which is similar to vm_insert_page (for non #PF). I tried this by > > introducing vm_insert_kmem_page ( * identical as vm_insert_page > > except API name *) in this patch. But this looks like a bad approach. > > We are going in circles here. That you want to convert vm_insert_page > to vmf_insert_page for the PF case is fine and understood. However, > you don't *need* to introduce a new name for the remaining non-PF > cases if the function is going to be the exact same thing as before. > You say "The final goal is to remove vm_insert_page", but you haven't > justified *why* you need to remove that name. > > Now, if we want to rename the function for some reason (e.g. avoid > confusion with vmf_insert_page), that is fine but is another topic. It > may be or not a good idea, but it is orthogonal to the vmf_ work. > Matthew, on this regard, told you that you shouldn't duplicate > functions. If you want a rename, do so; but don't copy the code. In > other words: nobody said introducing the vm_insert_kmem_page name is a > bad idea -- what Matthew told you is that *duplicating* vm_insert_page > just for that is bad. > > Further, you are copying the code (if I understand your thought > process) because you want to change the callers of non-PF first, and > then do the "full conversion from vm_* to vmf_*". However, that is > confusing, because there is no need to change non-PF callers of > vm_insert_page since they don't care about the new vmf_* functions. > > Instead, the proper way of doing this is: > > 1. Introduce the vmf_* API > 2. Change all PF-users users to that (leaving all non-PF ones > untouched!) -- if this is too big, you can split this patch into > several patches, one per subsystem, etc. We are done with step 2. All the PF-users are converted to use vmf_insert_page. ( Ref - linux-next-20181005) > 3. Remove the vm_* functions (except the ones that are still used in > non-PF contexts, e.g. vm_insert_page) Step 3 is part of step 2. Already done. > > Then, optionally, if you want to rename the function for the remaining > non-PF users: > > 4. Rename vm_insert_page (justifying why the current name is > confusing *on its own merits*). > > Otherwise, if you want to pursue Matthew's idea: > > 4. Introduce the vm_insert_range (possibly leveraging > vm_insert_page, or not; you have to see what is best). > 5. Replace those callers that can take advantage of vm_insert_range > 6. Remove vm_insert_page and replace callers with vm_insert_range > (only if it is not worth to keep vm_insert_range, again justifying it > *on its own merits*) Step 4 to 6, going to do it. It is part of plan now :-) > > As you see, these are all logical step-by-step improvements, without > duplicating functions temporarily, leaving temporary changes or > changing current callers to new APIs for unrelated reasons (i.e. no > need to introduce vm_insert_kmem_page simply to do a "conversion" to > vmf_). > > Cheers, > Miguel