All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Matthew Auld <matthew.auld@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 17/18] mm/shmem: tweak the huge-page interface
Date: Wed, 5 Apr 2017 08:42:54 +0200	[thread overview]
Message-ID: <20170405064254.ljxhc7grz2p7galj@phenom.ffwll.local> (raw)
In-Reply-To: <20170404221128.3943-18-matthew.auld@intel.com>

On Tue, Apr 04, 2017 at 11:11:27PM +0100, Matthew Auld wrote:
> In its current form huge-pages through shmemfs are controlled at the
> super-block level, and are currently disabled by default, so to enable
> huge-pages for a shmem backed gem object we would need to re-mount the
> fs with the huge= argument, but for drm the mount is not user visible,
> so good luck with that. The other option is the global sysfs knob
> shmem_enabled which exposes the same huge= options, with the addition of
> DENY and FORCE.
> 
> Neither option seems really workable, what we probably want is to able
> to control the use of huge-pages at the time of pinning the backing
> storage for a particular gem object, and only where it makes sense given
> the size of the object. One caveat is when we write into the page cache
> prior to pinning the backing storage. I played around with a bunch of
> ideas but in the end just settled with driver overridable huge option
> embedded in shmem_inode_info. Thoughts?
> 
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>

You need to Cc: mm folks and mailing lists for this. Ask
scripts/get_maintainers.pl for the full list please. Otherwise this can't
ever land (and we're looking at along time of bikeshedding anyway).
-Daniel

> ---
>  include/linux/shmem_fs.h |  1 +
>  mm/shmem.c               | 10 ++++++++--
>  2 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
> index a7d6bd2a918f..001be751420d 100644
> --- a/include/linux/shmem_fs.h
> +++ b/include/linux/shmem_fs.h
> @@ -21,6 +21,7 @@ struct shmem_inode_info {
>  	struct shared_policy	policy;		/* NUMA memory alloc policy */
>  	struct simple_xattrs	xattrs;		/* list of xattrs */
>  	struct inode		vfs_inode;
> +	bool                    huge;           /* driver override shmem_huge */
>  };
>  
>  struct shmem_sb_info {
> diff --git a/mm/shmem.c b/mm/shmem.c
> index e67d6ba4e98e..879a9e514afe 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -1723,6 +1723,9 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index,
>  		/* shmem_symlink() */
>  		if (mapping->a_ops != &shmem_aops)
>  			goto alloc_nohuge;
> +		/* driver override shmem_huge */
> +		if (info->huge)
> +			goto alloc_huge;
>  		if (shmem_huge == SHMEM_HUGE_DENY || sgp_huge == SGP_NOHUGE)
>  			goto alloc_nohuge;
>  		if (shmem_huge == SHMEM_HUGE_FORCE)
> @@ -2000,6 +2003,7 @@ unsigned long shmem_get_unmapped_area(struct file *file,
>  	unsigned long inflated_len;
>  	unsigned long inflated_addr;
>  	unsigned long inflated_offset;
> +	struct shmem_inode_info *info = SHMEM_I(file_inode(file));
>  
>  	if (len > TASK_SIZE)
>  		return -ENOMEM;
> @@ -2016,7 +2020,7 @@ unsigned long shmem_get_unmapped_area(struct file *file,
>  	if (addr > TASK_SIZE - len)
>  		return addr;
>  
> -	if (shmem_huge == SHMEM_HUGE_DENY)
> +	if (!info->huge && shmem_huge == SHMEM_HUGE_DENY)
>  		return addr;
>  	if (len < HPAGE_PMD_SIZE)
>  		return addr;
> @@ -2030,7 +2034,7 @@ unsigned long shmem_get_unmapped_area(struct file *file,
>  	if (uaddr)
>  		return addr;
>  
> -	if (shmem_huge != SHMEM_HUGE_FORCE) {
> +	if (!info->huge && shmem_huge != SHMEM_HUGE_FORCE) {
>  		struct super_block *sb;
>  
>  		if (file) {
> @@ -4034,6 +4038,8 @@ bool shmem_huge_enabled(struct vm_area_struct *vma)
>  	loff_t i_size;
>  	pgoff_t off;
>  
> +	if (SHMEM_I(inode)->huge)
> +		return true;
>  	if (shmem_huge == SHMEM_HUGE_FORCE)
>  		return true;
>  	if (shmem_huge == SHMEM_HUGE_DENY)
> -- 
> 2.9.3
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-04-05  6:43 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-04 22:11 [RFC PATCH 00/18] drm/i915: initial support for huge gtt pages V2 Matthew Auld
2017-04-04 22:11 ` [PATCH 01/18] drm/i915: add page_size_mask to dev_info Matthew Auld
2017-04-05  6:19   ` Joonas Lahtinen
2017-04-05  8:45     ` Chris Wilson
2017-04-05 12:57       ` Joonas Lahtinen
2017-04-05  8:43   ` Chris Wilson
2017-04-04 22:11 ` [PATCH 02/18] drm/i915: introduce drm_i915_gem_object page_size members Matthew Auld
2017-04-05  6:26   ` Joonas Lahtinen
2017-04-05  6:49   ` Daniel Vetter
2017-04-05  8:48     ` Chris Wilson
2017-04-05 10:07       ` Matthew Auld
2017-04-05 12:15         ` Daniel Vetter
2017-04-05 12:32         ` Chris Wilson
2017-04-05 12:39           ` Chris Wilson
2017-04-04 22:11 ` [PATCH 03/18] drm/i915: pass page_size to insert_entries Matthew Auld
2017-04-04 22:11 ` [PATCH 04/18] drm/i915: s/i915_gtt_color_adjust/i915_ggtt_color_adjust Matthew Auld
2017-04-05  6:30   ` Joonas Lahtinen
2017-04-04 22:11 ` [PATCH 05/18] drm/i915: clean up cache coloring Matthew Auld
2017-04-05  6:35   ` Joonas Lahtinen
2017-04-04 22:11 ` [PATCH 06/18] drm/i915: export color_differs Matthew Auld
2017-04-05  6:39   ` Joonas Lahtinen
2017-04-04 22:11 ` [PATCH 07/18] drm/i915: introduce ppgtt page coloring Matthew Auld
2017-04-05 13:41   ` Chris Wilson
2017-04-05 13:50     ` Matthew Auld
2017-04-05 14:02       ` Chris Wilson
2017-04-05 15:05         ` Matthew Auld
2017-04-10 12:08         ` Matthew Auld
2017-04-04 22:11 ` [PATCH 08/18] drm/i915: handle evict-for-node with " Matthew Auld
2017-04-04 22:11 ` [PATCH 09/18] drm/i915: support inserting 64K pages in the ppgtt Matthew Auld
2017-04-06  3:25   ` kbuild test robot
2017-04-09  0:27   ` kbuild test robot
2017-04-04 22:11 ` [PATCH 10/18] drm/i915: support inserting 2M " Matthew Auld
2017-04-04 22:11 ` [PATCH 11/18] drm/i915: support inserting 1G " Matthew Auld
2017-04-04 22:11 ` [PATCH 12/18] drm/i915: disable GTT cache for huge-pages Matthew Auld
2017-04-04 22:11 ` [PATCH 13/18] drm/i915/selftests: exercise 4K and 64K mm insertion Matthew Auld
2017-04-04 22:11 ` [PATCH 14/18] drm/i915/selftests: modify the gtt tests to also exercise huge pages Matthew Auld
2017-04-04 22:11 ` [PATCH 15/18] drm/i915/selftests: exercise evict-for-node page coloring Matthew Auld
2017-04-04 22:11 ` [PATCH 16/18] drm/i915/debugfs: include some huge-page metrics Matthew Auld
2017-04-04 22:11 ` [PATCH 17/18] mm/shmem: tweak the huge-page interface Matthew Auld
2017-04-05  6:42   ` Daniel Vetter [this message]
2017-04-04 22:11 ` [PATCH 18/18] drm/i915: support transparent-huge-pages through shmemfs Matthew Auld
2017-04-05  8:53 ` [RFC PATCH 00/18] drm/i915: initial support for huge gtt pages V2 Chris Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170405064254.ljxhc7grz2p7galj@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.