lkml.org 
[lkml]   [2003]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: POSIX timer syscalls
David Mosberger wrote:
>>>>>>On Thu, 06 Mar 2003 17:39:16 -0800, george anzinger <george@mvista.com> said:
>
>
> George> Ok, I will fix all the above and shoot you a patch. I
> George> assume you can test it on a 64-bit platform. Right?
>
The patch to fix idr is attached. Cleans up the int/long confusion
and also rearranges a couple of structures to honor the sizes involved.

> Sure, except I don't have a test-program. ;-)
>
That is why you should visit the High-res-timers web site (see URL
below) and get the "support" patch. It installs in you kernel tree at
.../Documentation/high-res-timers/ and has test programs as well as
man pages, readme files etc.

By the way, I am seeing some reports from the clock_nanosleep test
about sleeping too long or too short. The too long appears to be just
not being able to preempt what ever else is running. The too short
(on the x86) is, I believe, due to the fact that more that 1/HZ is
clocked on the wall clock each jiffie.

Try this:

time sleep 60

On the x86 it reports less than 60, NOT good.

--
George Anzinger george@mvista.com
High-res-timers: http://sourceforge.net/projects/high-res-timers/
Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml
diff -urP -I '\$Id:.*Exp \$' -X /usr/src/patch.exclude linux-2.5.64-kb/include/linux/idr.h linux/include/linux/idr.h
--- linux-2.5.64-kb/include/linux/idr.h 2003-03-05 15:09:48.000000000 -0800
+++ linux/include/linux/idr.h 2003-03-06 18:04:26.000000000 -0800
@@ -25,9 +25,12 @@

#define IDR_MASK ((1 << IDR_BITS)-1)

-/* Leave the possibility of an incomplete final layer */
-#define MAX_LEVEL (BITS_PER_LONG - RESERVED_ID_BITS + IDR_BITS - 1) / IDR_BITS
-#define MAX_ID_SHIFT (BITS_PER_LONG - RESERVED_ID_BITS)
+/* Leave the possibility of an incomplete final layer
+ * Note we will return a 32-bit int, not a long, thus the
+ * 32 below
+*/
+#define MAX_LEVEL (32 - RESERVED_ID_BITS + IDR_BITS - 1) / IDR_BITS
+#define MAX_ID_SHIFT (32 - RESERVED_ID_BITS)
#define MAX_ID_BIT (1L << MAX_ID_SHIFT)
#define MAX_ID_MASK (MAX_ID_BIT - 1)

@@ -36,15 +39,15 @@

struct idr_layer {
unsigned long bitmap; // A zero bit means "space here"
- int count; // When zero, we can release it
struct idr_layer *ary[1<<IDR_BITS];
+ int count; // When zero, we can release it
};

struct idr {
struct idr_layer *top;
- int layers;
- long count;
struct idr_layer *id_free;
+ long count;
+ int layers;
int id_free_cnt;
spinlock_t lock;
};
Binary files linux-2.5.64-kb/lib/gen_crc32table and linux/lib/gen_crc32table differ
diff -urP -I '\$Id:.*Exp \$' -X /usr/src/patch.exclude linux-2.5.64-kb/lib/idr.c linux/lib/idr.c
--- linux-2.5.64-kb/lib/idr.c 2003-03-05 15:09:50.000000000 -0800
+++ linux/lib/idr.c 2003-03-06 18:04:29.000000000 -0800
@@ -150,7 +150,7 @@

static inline int sub_alloc(struct idr *idp, int shift, void *ptr)
{
- long n, v = 0;
+ int n, v = 0;
struct idr_layer *p;
struct idr_layer **pa[MAX_LEVEL];
struct idr_layer ***paa = &pa[0];
@@ -211,7 +211,7 @@

int idr_get_new(struct idr *idp, void *ptr)
{
- long v;
+ int v;

if (idp->id_free_cnt < idp->layers + 1)
return (-1);
Binary files linux-2.5.64-kb/scripts/docproc and linux/scripts/docproc differ
Binary files linux-2.5.64-kb/scripts/fixdep and linux/scripts/fixdep differ
Binary files linux-2.5.64-kb/scripts/kallsyms and linux/scripts/kallsyms differ
Binary files linux-2.5.64-kb/scripts/mk_elfconfig and linux/scripts/mk_elfconfig differ
Binary files linux-2.5.64-kb/scripts/modpost and linux/scripts/modpost differ
Binary files linux-2.5.64-kb/usr/gen_init_cpio and linux/usr/gen_init_cpio differ
Binary files linux-2.5.64-kb/usr/initramfs_data.cpio.gz and linux/usr/initramfs_data.cpio.gz differ
\
 
 \ /
  Last update: 2005-03-22 13:33    [W:0.056 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site