Re: [PATCH v4 5/6] drm/gem-shmem: Track folio accessed/dirty status in mmap

Thomas Zimmermann
2026-03-13T10:29:54Z

Hi

Am 13.03.26 um 11:18 schrieb Boris Brezillon:
[...]
>>>>> + if (drm_WARN_ON(obj->dev, !shmem->pages || page_offset >= num_pages))
>>>>> + return VM_FAULT_SIGBUS;
>>>>> +
>>>>> + file_update_time(vma->vm_file);
>>>>> +
>>>>> + folio_mark_dirty(page_folio(shmem->pages[page_offset]));
> Do we need a folio_mark_dirty_lock() here?

There is a helper for that with some documentation. [1]

[1]
https://elixir.bootlin.com/linux/v6.19.7/source/mm/page-writeback.c#L2826

Best regards
Thomas

>
>>>>> +
>>>>> + return 0;
>>>>> +}
>>>>> +
>>>>> const struct vm_operations_struct drm_gem_shmem_vm_ops = {
>>>>> .fault = drm_gem_shmem_fault,
>>>>> .open = drm_gem_shmem_vm_open,
>>>>> .close = drm_gem_shmem_vm_close,
>>>>> + .pfn_mkwrite = drm_gem_shmem_pfn_mkwrite,
>>>>> };
>>>>> EXPORT_SYMBOL_GPL(drm_gem_shmem_vm_ops);
>>>>>
>>>>> --
>>>>> 2.52.0
>>>>>

--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)