Message ID | 1449773486-30822-3-git-send-email-david.s.gordon@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Dec 10, 2015 at 06:51:24PM +0000, Dave Gordon wrote: > When creating a new (pageable) GEM object and filling it with data, we > must mark it as 'dirty', i.e. backing store is out-of-date w.r.t. the > newly-written content. This ensures that if the object is evicted under > memory pressure, its pages in the pagecache will be written to backing > store rather than discarded. > > Based on an original version by Alex Dai. > > Signed-off-by: Alex Dai <yu.dai@intel.com> > Signed-off-by: Dave Gordon <david.s.gordon@intel.com> > Cc: Chris Wilson <chris@chris-wilson.co.uk> I've made my peace with this patch finally. Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> > --- > drivers/gpu/drm/i915/i915_gem.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c > index 06a5f39..936f0a9 100644 > --- a/drivers/gpu/drm/i915/i915_gem.c > +++ b/drivers/gpu/drm/i915/i915_gem.c > @@ -5224,6 +5224,7 @@ i915_gem_object_create_from_data(struct drm_device *dev, > i915_gem_object_pin_pages(obj); > sg = obj->pages; > bytes = sg_copy_from_buffer(sg->sgl, sg->nents, (void *)data, size); > + obj->dirty = 1; /* Backing store is now out of date */ That seems like it would be better served as an improvement to the existing obj->dirty /** doc */ -Chris
On Thu, Dec 10, 2015 at 09:06:25PM +0000, Chris Wilson wrote: > On Thu, Dec 10, 2015 at 06:51:24PM +0000, Dave Gordon wrote: > > When creating a new (pageable) GEM object and filling it with data, we > > must mark it as 'dirty', i.e. backing store is out-of-date w.r.t. the > > newly-written content. This ensures that if the object is evicted under > > memory pressure, its pages in the pagecache will be written to backing > > store rather than discarded. > > > > Based on an original version by Alex Dai. > > > > Signed-off-by: Alex Dai <yu.dai@intel.com> > > Signed-off-by: Dave Gordon <david.s.gordon@intel.com> > > Cc: Chris Wilson <chris@chris-wilson.co.uk> > > I've made my peace with this patch finally. > Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> > > > --- > > drivers/gpu/drm/i915/i915_gem.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c > > index 06a5f39..936f0a9 100644 > > --- a/drivers/gpu/drm/i915/i915_gem.c > > +++ b/drivers/gpu/drm/i915/i915_gem.c > > @@ -5224,6 +5224,7 @@ i915_gem_object_create_from_data(struct drm_device *dev, > > i915_gem_object_pin_pages(obj); > > sg = obj->pages; > > bytes = sg_copy_from_buffer(sg->sgl, sg->nents, (void *)data, size); > > + obj->dirty = 1; /* Backing store is now out of date */ > > That seems like it would be better served as an improvement to the > existing obj->dirty /** doc */ Yeah doc polish at the end would be stellar. Merged the first 2 patches from this series meanwhile. -Daniel
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 06a5f39..936f0a9 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -5224,6 +5224,7 @@ i915_gem_object_create_from_data(struct drm_device *dev, i915_gem_object_pin_pages(obj); sg = obj->pages; bytes = sg_copy_from_buffer(sg->sgl, sg->nents, (void *)data, size); + obj->dirty = 1; /* Backing store is now out of date */ i915_gem_object_unpin_pages(obj); if (WARN_ON(bytes != size)) {