From: Matt Mackall <mpm@selenic.com>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Paul Menage <menage@google.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -mm 1/2] sort: Add obj_sort() for sorting all kinds of random-accessible objects
Date: Fri, 12 Sep 2008 10:56:04 -0500 [thread overview]
Message-ID: <1221234964.5277.482.camel@calx> (raw)
In-Reply-To: <48CA58A4.8020902@cn.fujitsu.com>
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.
prev parent reply other threads:[~2008-09-12 15:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-12 11:55 [PATCH -mm 1/2] sort: Add obj_sort() for sorting all kinds of random-accessible objects Lai Jiangshan
2008-09-12 15:56 ` Matt Mackall [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=1221234964.5277.482.camel@calx \
--to=mpm@selenic.com \
--cc=akpm@linux-foundation.org \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=menage@google.com \
--cc=torvalds@linux-foundation.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 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.