Re: [PATCH] Export shmem_file_setup and shmem_getpage for DRM-GEM
- From: Hugh Dickins <hugh@xxxxxxxxxxx>
- Date: Mon, 4 Aug 2008 19:39:32 +0100 (BST)
On Mon, 4 Aug 2008, Keith Packard wrote:
On Mon, 2008-08-04 at 18:09 +0100, Hugh Dickins wrote:
Whether such usage conforms to VFS API I'm not so sure: as I understand
it, it's really for internal use by a filesystem
Sure, but presumably it could even be used by a layered file system?
Could, yes, but should? I wouldn't presume to answer with any authority.
- if it's going to be
used beyond that, we ought to add a check that the filesystem it's used
upon really has a ->readpage method (and I'd rather we add such a check
than you do it at your end, in case we change the implementation later
to use something other than a ->readpage method - Nick, you'll be
nauseated to hear I was looking to see if ->fault with a pseudo-vma
could do it). But if the layering police are happy with this, I am.
It seems like I should put a check into my code that is kernel version
dependent so that I can't oops if someone tries to use a filesystem that
doesn't have ->readpage.
Well, I guess put the check on ->readpage into your code for now, and
by the time GEM gets into Linus's tree, we should have -EINVAL checks
on NULL filler() in __read_cache_page() and read_cache_page_async(),
so remove check at your end before final submission.
(You could leave it there, and strictly we ought to update GEM if we
make any change to our implementation; but it is the kind of detail
that gets overlooked - witness the way I failed to grasp the readahead
side-effects of adding ->readpage into tmpfs until recently. I'm just
afraid we'd break you unwittingly: better not, though easily fixed.)
I'm not sending the patch right now, waiting to see if this direction
wins general favour.
So, when I release the pages from the page cache, I'm currently calling
mark_page_accessed for all pages, and set_page_dirty for pages which may
have been written by the GPU. Are those calls still needed?
I think you should drop the mark_page_accessed(): that's done in
read_cache_page_async() as part of the initial read_mapping_page().
But do it again when releasing if you think there's a good chance
that object will be wanted again shortly. set_page_dirty() if
modified by GPU, yes, that would still be needed.
For how long are these objects' pages pinned in memory like this?
I ask because Rik & Lee have patches in -mm, trying to avoid long
scans of LRUs cluttered with unevictable pages. I've no idea
whether you're adding a lot or a little to that problem.
Hugh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- Re: [PATCH] Export shmem_file_setup and shmem_getpage for DRM-GEM
- From: Keith Packard
- Re: [PATCH] Export shmem_file_setup and shmem_getpage for DRM-GEM
- References:
- [PATCH] PCI: Add pci_read_base() API
- From: Eric Anholt
- Re: [PATCH] Export shmem_file_setup and shmem_getpage for DRM-GEM
- From: Nick Piggin
- Re: [PATCH] Export shmem_file_setup and shmem_getpage for DRM-GEM
- From: Keith Packard
- Re: [PATCH] Export shmem_file_setup and shmem_getpage for DRM-GEM
- From: Nick Piggin
- Re: [PATCH] Export shmem_file_setup and shmem_getpage for DRM-GEM
- From: Keith Packard
- Re: [PATCH] Export shmem_file_setup and shmem_getpage for DRM-GEM
- From: Hugh Dickins
- Re: [PATCH] Export shmem_file_setup and shmem_getpage for DRM-GEM
- From: Keith Packard
- [PATCH] PCI: Add pci_read_base() API
- Prev by Date: Re: [stable] [RFC, 2.6.26.2-rc1] NFS: Ensure we call nfs_sb_deactive() after releasing the directory inode
- Next by Date: Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock()
- Previous by thread: Re: [PATCH] Export shmem_file_setup and shmem_getpage for DRM-GEM
- Next by thread: Re: [PATCH] Export shmem_file_setup and shmem_getpage for DRM-GEM
- Index(es):