From: Huang Rui <ray.huang@amd.com>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] list: introduce list_bulk_move_tail helper
Date: Fri, 14 Sep 2018 10:53:19 +0800 [thread overview]
Message-ID: <20180914025228.GA17902@hr-amur2> (raw)
In-Reply-To: <20180913112208.1353-1-christian.koenig@amd.com>
On Thu, Sep 13, 2018 at 01:22:07PM +0200, Christian König wrote:
> Move all entries between @first and including @last before @head.
>
> This is useful for LRU lists where a whole block of entries should be
> moved to the end of an list.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
Bulk move helper is useful for TTM driver to improve the LRU moving
efficiency. Please go on with my RB.
Series are Reviewed-and-Tested-by: Huang Rui <ray.huang@amd.com>
> ---
> include/linux/list.h | 23 +++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
>
> diff --git a/include/linux/list.h b/include/linux/list.h
> index de04cc5ed536..edb7628e46ed 100644
> --- a/include/linux/list.h
> +++ b/include/linux/list.h
> @@ -183,6 +183,29 @@ static inline void list_move_tail(struct list_head *list,
> list_add_tail(list, head);
> }
>
> +/**
> + * list_bulk_move_tail - move a subsection of a list to its tail
> + * @head: the head that will follow our entry
> + * @first: first entry to move
> + * @last: last entry to move, can be the same as first
> + *
> + * Move all entries between @first and including @last before @head.
> + * All three entries must belong to the same linked list.
> + */
> +static inline void list_bulk_move_tail(struct list_head *head,
> + struct list_head *first,
> + struct list_head *last)
> +{
> + first->prev->next = last->next;
> + last->next->prev = first->prev;
> +
> + head->prev->next = first;
> + first->prev = head->prev;
> +
> + last->next = head;
> + head->prev = last;
> +}
> +
> /**
> * list_is_last - tests whether @list is the last entry in list @head
> * @list: the entry to test
> --
> 2.14.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
prev parent reply other threads:[~2018-09-14 2:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-13 11:22 [PATCH 1/2] list: introduce list_bulk_move_tail helper Christian König
2018-09-13 11:22 ` [PATCH 2/2] drm/ttm: once more fix ttm_bo_bulk_move_lru_tail v2 Christian König
2018-09-13 15:52 ` Mike Lothian
2018-09-14 2:53 ` Huang Rui [this message]
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=20180914025228.GA17902@hr-amur2 \
--to=ray.huang@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=ckoenig.leichtzumerken@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.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