From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] fs: use kmalloc() to allocate fdmem if possible Date: Mon, 03 May 2010 12:28:51 +0300 Message-ID: <4BDE9753.1080106@redhat.com> References: <1272818776-7729-1-git-send-email-xiaosuo@gmail.com> <4BDDB6E9.4060703@redhat.com> <201005030915.FCD09385.FFHVOMJtSLOFQO@I-love.SAKURA.ne.jp> <4BDE67DA.4080004@redhat.com> <4BDE7E66.8030509@redhat.com> <4BDE8E24.5050200@redhat.com> <4BDE914C.6080504@suse.cz> <4BDE94C8.9000108@redhat.com> <4BDE95F2.1020506@suse.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Changli Gao , Tetsuo Handa , akpm@linux-foundation.org, paulmck@linux.vnet.ibm.com, adobriyan@gmail.com, mingo@elte.hu, peterz@infradead.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org To: Jiri Slaby Return-path: In-Reply-To: <4BDE95F2.1020506@suse.cz> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On 05/03/2010 12:22 PM, Jiri Slaby wrote: > On 05/03/2010 11:18 AM, Avi Kivity wrote: > >> On 05/03/2010 12:03 PM, Jiri Slaby wrote: >> >>>>> Because vmalloc is used to allocate virtually contiguous memory. v in >>>>> vmalloc means virtually. >>>>> >>>>> >>>>> >>>>> >>>> A kmalloc()ed page is virtually contiguous, satisfying your requirement. >>>> >>>> >>> But it won't work well for vmalloc_to_{page,pfn} and similar. >>> >> Modify vmalloc_to_{page,pfn} accordingly. >> > When you get a slub in the middle of page, how? > Er, right. So a separate API is needed for users who are interested in memory, not pages. >>> Some code >>> may expect vmalloc result to be in the vmalloc area and page-aligned >>> (both in position and size). >>> >>> >> Both would be a bug IMO. vmalloc() follows kmalloc() and malloc() which >> only guarantee natural alignment. >> > Nope, from what I understand, vmalloc aligns (uses page allocator). Even > for purposes of vmalloc_to_*. > Correct, my mistake. -- error compiling committee.c: too many arguments to function