Re: [PATCH] Export shmem_file_setup and shmem_getpage for DRM-GEM

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Hugh Dickins <hugh@...>
Cc: <keithp@...>, Eric Anholt <eric@...>, <linux-kernel@...>
Date: Friday, August 1, 2008 - 2:06 pm

On Fri, 2008-08-01 at 11:57 +0100, Hugh Dickins wrote:


Cool. Using shmem saved a huge amount of code in DRM and allows the GEM
objects to be paged to disk if necessary. We haven't added the shrinker
API calls to finish this work, but that shouldn't take much additional
code.


We use it to get a struct page within a shmem object; we don't need the
sgp types exposed as we only ever use SGP_DIRTY. We could use a narrower
interface like:

int shmem_file_page(struct file *file, int idx, struct page **page)
{
        struct inode *inode =3D file->f_path.dentry->d_inode;

        return shmem_getpage(inode, idx, page, SGP_DIRTY, NULL);
}
EXPORT_SYMBOL(shmem_file_page);



Seems like the simpler interface should be supportable from ramfs:

int shmem_file_page(struct file *file, int idx, struct page **page)
{
        struct inode *inode =3D file->f_path.dentry->d_inode;
        struct address_space *mapping =3D inode->i_mapping;
        struct page *filepage;
       =20
        filepage =3D find_lock_page(mapping, idx);
        if (!filepage)
                return -ENOSPC;
        *page =3D filepage;
        return 0;
}

(no, I didn't try this)


I don't know; I'm running without swap on several netbooks these days,
and I can easily believe that TINY would be a reasonable option there.
Thanks for the suggestions.

--=20
keith.packard@intel.com
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] PCI: Add pci_read_base() API, Eric Anholt, (Fri Aug 1, 2:58 am)
Re: [PATCH] Export shmem_file_setup and shmem_getpage for DR..., Christoph Hellwig, (Sun Aug 10, 9:30 pm)
Re: [PATCH] Export shmem_file_setup and shmem_getpage for DR..., Stephane Marchesin, (Wed Aug 6, 12:20 pm)
Re: [PATCH] Export shmem_file_setup and shmem_getpage for DR..., Christoph Hellwig, (Sun Aug 10, 9:34 pm)
Re: [PATCH] Export shmem_file_setup and shmem_getpage for DR..., Stephane Marchesin, (Wed Aug 6, 10:16 pm)
Re: [PATCH] Export shmem_file_setup and shmem_getpage for DR..., Stephane Marchesin, (Wed Aug 6, 1:32 pm)
Re: [PATCH] Export shmem_file_setup and shmem_getpage for DR..., Stephane Marchesin, (Wed Aug 6, 2:09 pm)
Re: [PATCH] Export shmem_file_setup and shmem_getpage for DR..., Christoph Hellwig, (Sun Aug 10, 9:23 pm)
Re: [PATCH] Export shmem_file_setup for DRM-GEM, Keith Packard, (Sun Aug 10, 11:03 pm)
Re: [PATCH] Export shmem_file_setup and shmem_getpage for DR..., Keith Packard, (Fri Aug 1, 2:06 pm)