From: Hugh Dickins <hughd@google.com>
To: akash goel <akash.goels@gmail.com>
Cc: Hugh Dickins <hughd@google.com>,
intel-gfx@lists.freedesktop.org, linux-mm@kvack.org,
Chris Wilson <chris@chris-wilson.co.uk>,
Sourab Gupta <sourab.gupta@intel.com>
Subject: Re: [PATCH 2/2] drm/i915: Make GPU pages movable
Date: Tue, 15 Nov 2016 17:25:48 -0800 (PST) [thread overview]
Message-ID: <alpine.LSU.2.11.1611151438090.1910@eggly.anvils> (raw)
In-Reply-To: <CAK_0AV0+1oizfRMfoJ45FWCRi_4X93W-ZtseY-s-R_wavE3fZQ@mail.gmail.com>
On Mon, 14 Nov 2016, akash goel wrote:
> On Thu, Nov 10, 2016 at 1:00 PM, Goel, Akash <akash.goel@intel.com> wrote:
> > On 11/10/2016 12:09 PM, Hugh Dickins wrote:
> >> On Fri, 4 Nov 2016, akash.goel@intel.com wrote:
> >>> @@ -4185,6 +4189,8 @@ struct drm_i915_gem_object *
> >>>
> >>> mask = GFP_HIGHUSER | __GFP_RECLAIMABLE;
> >>> + if (IS_ENABLED(MIGRATION))
Oh, I knew I'd seen a line like that recently, and it was bugging me
that I ought to search my mailboxes for it; but now I'm glad to find
it again. If that condition stays, it would really need to say
if (IS_ENABLED(CONFIG_MIGRATION))
wouldn't it?
> >>> + mask |= __GFP_MOVABLE;
> >>
> >>
> >> I was going to suggest just make that unconditional,
> >> mask = GFP_HIGHUSER_MOVABLE | __GFP_RECLAIMABLE;
> >>
> >> But then I wondered what that __GFP_RECLAIMABLE actually achieves?
> >> These pages are already __GFP_RECLAIM (inside GFP_HIGHUSER) and on
> >> the LRU. It affects gfpflags_to_migratetype(), but I'm not familiar
> >> with what that different migratetype will end up doing.
> >>
> >
> > Will check for this.
> >
>
> The anti-fragmentation technique used by kernel is based on the idea
> of grouping pages with identical mobility (UNMOVABLE, RECLAIMABLE,
> MOVABLE) together.
Yes.
> __GFP_RECLAIMABLE, like __GFP_MOVABLE, specifies the
> mobility/migration type of the page and serves a different purpose
> than __GFP_RECLAIM.
Yes, I was wrong to mention __GFP_RECLAIM above: it describes what
to do when in difficulty allocating a page, but says nothing at all
about the nature of the page to be allocated.
>
> Also as per the below snippet from gfpflags_to_migratetype(), looks
> like __GFP_MOVABLE & __GFP_RECLAIMABLE can't be used together, which
> makes sense.
> /* Convert GFP flags to their corresponding migrate type */
> #define GFP_MOVABLE_MASK (__GFP_RECLAIMABLE | __GFP_MOVABLE)
> static inline int gfpflags_to_migratetype(const gfp_t gfp_flags)
> {
> VM_WARN_ON((gfp_flags & GFP_MOVABLE_MASK) == GFP_MOVABLE_MASK);
> .....
You're right, that does exclude them from being used together. And it
makes sense inasmuch as they're expected to be appled to quite different
uses of a page (lru pages versus slab pages).
The comment on __GFP_MOVABLE says "or can be reclaimed"; and
the comment on __GFP_RECLAIMABLE says "used for slab allocations...".
Though it does not say "used for allocations not put on a reclaimable
lru", I think that is the intention; whereas shmem allocations are put
on a reclaimable lru (though they might need your shrinker to unpin them).
>
> So probably would need to update the mask like this,
> mask = GFP_HIGHUSER;
> if (IS_ENABLED(MIGRATION))
> mask |= __GFP_MOVABLE;
> else
> mask |= __GFP_RECLAIMABLE;
>
> Please kindly let us know if this looks fine to you or not.
Thanks for looking into it more deeply. You leave me thinking that
it should simply say
mask = GFP_HIGHUSER_MOVABLE;
Which is the default anyway, but it then has the Crestline+Broadwater
condition to modify the mask further, so it's probably clearest to
leave the mask = GFP_HIGHUSER_MOVABLE explicit.
GFP_HIGHUSER_MOVABLE is used in many places, and includes __GFP_MOVABLE
without any condition on CONFIG_MIGRATION - because the migratetype is
irrelevant if there is no migration, I presume.
Would you lose something by not or'ing in __GFP_RECLAIMABLE when
CONFIG_MIGRATION=n? No, because __GFP_RECLAIMABLE is not used for
anything but the migratetype, and the migratetype is then irrelevant.
(I didn't study the code closely enough to say whether the grouping
can still happen even when migration is disabled, but even if it
does still happen, I can't see that it would have any benefit.)
Hugh
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2016-11-16 1:26 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-04 15:02 [PATCH 1/2] shmem: Support for registration of driver/file owner specific ops akash.goel
2016-11-04 15:02 ` [PATCH 2/2] drm/i915: Make GPU pages movable akash.goel
2016-11-09 11:28 ` Daniel Vetter
2016-11-09 18:36 ` Hugh Dickins
2016-11-22 16:02 ` [Intel-gfx] " Matthew Auld
2016-11-23 5:26 ` Hugh Dickins
2016-11-23 8:36 ` Daniel Vetter
2016-11-23 19:00 ` Hugh Dickins
2016-11-10 6:39 ` Hugh Dickins
2016-11-10 7:30 ` Goel, Akash
2016-11-14 7:57 ` akash goel
2016-11-16 1:25 ` Hugh Dickins [this message]
2016-11-16 5:13 ` akash goel
2016-11-10 5:36 ` [PATCH 1/2] shmem: Support for registration of driver/file owner specific ops Hugh Dickins
2016-11-10 16:22 ` Goel, Akash
2016-11-11 13:50 ` Chris Wilson
-- strict thread matches above, loose matches on Subject: below --
2016-10-20 15:15 [Intel-gfx] [PATCH 1/2] shmem: Support for registration of Driver/file " Joonas Lahtinen
2016-11-04 12:48 ` [PATCH 1/2] shmem: Support for registration of driver/file " akash.goel
2016-11-04 12:48 ` [PATCH 2/2] drm/i915: Make GPU pages movable akash.goel
2016-11-04 13:37 ` Chris Wilson
2016-11-04 13:53 ` Goel, Akash
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=alpine.LSU.2.11.1611151438090.1910@eggly.anvils \
--to=hughd@google.com \
--cc=akash.goels@gmail.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-mm@kvack.org \
--cc=sourab.gupta@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox