From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757633AbcDGV3D (ORCPT ); Thu, 7 Apr 2016 17:29:03 -0400 Received: from g9t5008.houston.hp.com ([15.240.92.66]:46894 "EHLO g9t5008.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757219AbcDGV3B (ORCPT ); Thu, 7 Apr 2016 17:29:01 -0400 Message-ID: <1460064033.20338.74.camel@hpe.com> Subject: Re: [PATCH] x86 get_unmapped_area: Add PMD alignment for DAX PMD mmap From: Toshi Kani To: Matthew Wilcox Cc: mingo@kernel.org, bp@suse.de, hpa@zytor.com, tglx@linutronix.de, dan.j.williams@intel.com, kirill.shutemov@linux.intel.com, linux-mm@kvack.org, x86@kernel.org, linux-nvdimm@ml01.01.org, linux-kernel@vger.kernel.org Date: Thu, 07 Apr 2016 15:20:33 -0600 In-Reply-To: <20160407174111.GG2781@linux.intel.com> References: <1459951089-14911-1-git-send-email-toshi.kani@hpe.com> <20160406165027.GA2781@linux.intel.com> <1459964672.20338.41.camel@hpe.com> <20160407174111.GG2781@linux.intel.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.18.5.2 (3.18.5.2-1.fc23) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2016-04-07 at 13:41 -0400, Matthew Wilcox wrote: > On Wed, Apr 06, 2016 at 11:44:32AM -0600, Toshi Kani wrote: > > > > > > The NVML chooses appropriate addresses and gets a properly aligned > > > address without any kernel code. > > > > An application like NVML can continue to specify a specific address to > > mmap().  Most existing applications, however, do not specify an address > > to mmap().  With this patch, specifying an address will remain > > optional. > > The point is that this *can* be done in userspace.  You need to sell us > on the advantages of doing it in the kernel. Sure.  As I said, the point is that we do not need to modify existing applications for using DAX PMD mappings. For instance, fio with "ioengine=mmap" performs I/Os with mmap(). https://github.com/caius/fio/blob/master/engines/mmap.c With this change, unmodified fio can be used for testing with DAX PMD mappings.  There are many examples like this, and I do not think we want to modify all applications that we want to evaluate/test with. > > > I think this is the wrong place for it, if we decide that this is the > > > right thing to do.  The filesystem has a get_unmapped_area() which > > > should be used instead. > > > > Yes, I considered adding a filesystem entry point, but decided going > > this way because: > >  - arch_get_unmapped_area() and arch_get_unmapped_area_topdown() are > > arch-specific code.  Therefore, this filesystem entry point will need > > arch-specific implementation.  > >  - There is nothing filesystem specific about requesting PMD alignment. > > See http://article.gmane.org/gmane.linux.kernel.mm/149227 for Hugh's > approach for shmem.  I strongly believe that if we're going to do this > i the kernel, we should build on this approach, and not hack something > into each architecture's generic get_unmapped_area. Thanks for the pointer.  Yes, we can call current->mm->get_unmapped_area() with size + PMD_SIZE, and adjust with the alignment in a filesystem entry point.  I will update the patch with this approach. -Toshi