From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tvrtko Ursulin Subject: Re: [RFC 0/3] Add new ioctl to resize gem object for deferred allocation Date: Mon, 07 Apr 2014 15:54:39 +0100 Message-ID: <5342BC2F.5000706@linux.intel.com> References: <1395934109-28522-1-git-send-email-arun.siluvery@linux.intel.com> <20140327222314.GA16117@nuc-i3427.alporthouse.com> <5342A59E.3090205@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id 83AF26E383 for ; Mon, 7 Apr 2014 07:56:14 -0700 (PDT) In-Reply-To: <5342A59E.3090205@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: "Siluvery, Arun" , Chris Wilson , intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On 04/07/2014 02:18 PM, Siluvery, Arun wrote: > On 27/03/2014 22:23, Chris Wilson wrote: >> On Thu, Mar 27, 2014 at 03:28:26PM +0000, >> arun.siluvery@linux.intel.com wrote: >>> From: "Siluvery, Arun" >>> >>> This patch series adds a new ioctl to resize a gem object. >> >> I'm tired, but off the top of my head, I think you can do away with the >> magic extension to create_ioctl. If we allow any one to fallocate() >> ranges of any object, the user can create a large object, populate it >> all with a scratch page, then later populate regions as required. This >> looks quite a reasonable and useful feature. >> -Chris >> > Could you clarify my understanding on how to use fallocate() to resize > the object, considering the case where we start with an object of size x > and want to increase its size to (x+y) at a later point. > My understanding is, first object is created with gem_create ioctl with > size x. At a later point if it is to be resized, we allocate y at the > end of x using fallocate(). It is allocating the pages for us and from > its implementation it is clear that the file size is updated with new > value if offset+len is greater than initial size. > Do we need to make any changes for GEM to get the new size or it is > completely transparent to it? > could you give an overview on how you think it should work? My understanding of what Chris said is that fallocate(2) could be used to toggle ranges of an object - from "normal" backing store, to scratch page backing store. There is a mode argument passed in to fallocate, so if that is zero you could populate the passed in range with scratch pages. Or if mode is FALLOC_FL_KEEP_SIZE you could allocate proper backing. Tvrtko