[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1221234964.5277.482.camel@calx>
Date: Fri, 12 Sep 2008 10:56:04 -0500
From: Matt Mackall <mpm@...enic.com>
To: Lai Jiangshan <laijs@...fujitsu.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Paul Menage <menage@...gle.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -mm 1/2] sort: Add obj_sort() for sorting all kinds of
random-accessible objects
On Fri, 2008-09-12 at 19:55 +0800, Lai Jiangshan wrote:
> current sort can only sort objects on continuous memory,
> but sometimes we need to sort objects on noncontinuous memory,
> this patch provide obj_sort() for this.
>
> Sometimes a C struct(the container of objects, or objects) may be designed
> with some high-level language's semantic meaning. obj_sort() can sort
> for them.
>
> obj_sort() is need for sort pids for cgroup.tasks file.
Ok, if I understand this correctly, your new function basically changes:
cmp(void *a, void *b) to cmp(void *obj, int a, int b)
swap(void *a, void *b, int size) to swap(void *obj, int a, int b)
Since neither function actually looks at the data directly, it seems we
could make a unified sort function with:
cmp(void *base, int a, int b)
swap(void *base, int a, int b, int size)
What is the underlying data structure you're sorting by the way? Years
ago, I wrote a very nice merge sort for linked lists that I never got
around to submitting.
--
Mathematics is the supreme nostalgia of our time.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists