From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
Dave Gordon <david.s.gordon@intel.com>,
intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v4 2/3] drm/i915: refactor duplicate object vmap functions (reworked)
Date: Tue, 23 Feb 2016 12:25:29 +0000 [thread overview]
Message-ID: <56CC4FB9.6000308@linux.intel.com> (raw)
In-Reply-To: <20160223115231.GI27386@nuc-i3427.alporthouse.com>
On 23/02/16 11:52, Chris Wilson wrote:
> On Tue, Feb 23, 2016 at 11:38:02AM +0000, Chris Wilson wrote:
>> Indeed, we would need a new notifier, pretty much for the sole use of
>> 32b. Grr, that will be a nuisance.
>
> Core changes:
>
> diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
> index d1f1d338af20..542a91c2785f 100644
> --- a/include/linux/vmalloc.h
> +++ b/include/linux/vmalloc.h
> @@ -187,4 +187,8 @@ pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms)
> #define VMALLOC_TOTAL 0UL
> #endif
>
> +struct notitifer_block;
> +int register_vmap_notifier(struct notifier_block *nb);
> +int unregister_vmap_notifier(struct notifier_block *nb);
> +
> #endif /* _LINUX_VMALLOC_H */
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index fb42a5bffe47..0735d82444f7 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -21,6 +21,7 @@
> #include <linux/debugobjects.h>
> #include <linux/kallsyms.h>
> #include <linux/list.h>
> +#include <linux/notifier.h>
> #include <linux/rbtree.h>
> #include <linux/radix-tree.h>
> #include <linux/rcupdate.h>
> @@ -344,6 +345,8 @@ static void __insert_vmap_area(struct vmap_area *va)
>
> static void purge_vmap_area_lazy(void);
>
> +static BLOCKING_NOTIFIER_HEAD(vmap_notify_list);
> +
> /*
> * Allocate a region of KVA of the specified size and alignment, within the
> * vstart and vend.
> @@ -356,6 +359,7 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
> struct vmap_area *va;
> struct rb_node *n;
> unsigned long addr;
> + unsigned long freed;
> int purged = 0;
> struct vmap_area *first;
>
> @@ -468,6 +472,12 @@ overflow:
> purged = 1;
> goto retry;
> }
> + freed = 0;
> + blocking_notifier_call_chain(&vmap_notify_list, 0, &freed);
> + if (freed > 0) {
> + purged = 0;
> + goto retry;
> + }
> if (printk_ratelimit())
> pr_warn("vmap allocation for size %lu failed: "
> "use vmalloc=<size> to increase size.\n", size);
> @@ -475,6 +485,18 @@ overflow:
> return ERR_PTR(-EBUSY);
> }
>
> +int register_vmap_notifier(struct notifier_block *nb)
> +{
> + return blocking_notifier_chain_register(&vmap_notify_list, nb);
> +}
> +EXPORT_SYMBOL_GPL(register_vmap_notifier);
> +
> +int unregister_vmap_notifier(struct notifier_block *nb)
> +{
> + return blocking_notifier_chain_unregister(&vmap_notify_list, nb);
> +}
> +EXPORT_SYMBOL_GPL(unregister_vmap_notifier);
> +
> static void __free_vmap_area(struct vmap_area *va)
> {
> BUG_ON(RB_EMPTY_NODE(&va->rb_node));
>
>
> That doesn't look too horrendous. Names?
Downside is new deadlock opportunity so GEM callers to vmap would have
to release the struct mutex.
> register_oovmap_notifier
> register_vmap_nospace_notifier?
> register_vmap_purge_notifier?
register_vmap_shrinker ?
> And the 64k question, how to sell it?
Not sure, maybe with numbers showing that caching the vmapping helps us
significantly?
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-02-23 12:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-22 15:18 [PATCH v4 0/3] Reorganise calls to vmap() GEM objects Dave Gordon
2016-02-22 15:18 ` [PATCH v4 1/3] drm/i915: add i915_gem_object_vmap_range() to map GEM object to virtual space Dave Gordon
2016-02-22 15:18 ` [PATCH v4 2/3] drm/i915: refactor duplicate object vmap functions (reworked) Dave Gordon
2016-02-22 16:06 ` Tvrtko Ursulin
2016-02-23 10:06 ` Chris Wilson
2016-02-23 10:31 ` Tvrtko Ursulin
2016-02-23 11:38 ` Chris Wilson
2016-02-23 11:52 ` Chris Wilson
2016-02-23 12:25 ` Tvrtko Ursulin [this message]
2016-02-23 12:56 ` Chris Wilson
2016-02-22 15:18 ` [PATCH v4 3/3] drm/i915: optimise i915_gem_object_vmap_range() for small objects Dave Gordon
2016-02-23 10:16 ` Chris Wilson
2016-02-23 8:37 ` ✗ Fi.CI.BAT: failure for Reorganise calls to vmap() GEM objects Patchwork
2016-02-23 10:59 ` Patchwork
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=56CC4FB9.6000308@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=david.s.gordon@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).