[patch-2.3.40-p1] poll on nfds > 16390 fails

From: Tigran Aivazian (tigran@sco.COM)
Date: Wed Jan 12 2000 - 08:27:29 EST


Hi Alan,

On your list of things this is the second item. I assume nobody is going
to enhance slab allocator to support larger than 128K at this stage,
perhaps you would consider even something as simple as this for a fix?

  http://www.ocston.org/~tigran/patches/pollfix-2.3.40-p1.patch

Regards,
----------
Tigran A. Aivazian | http://www.sco.com
Escalations Research Group | tel: +44-(0)1923-813796
Santa Cruz Operation Ltd | http://www.ocston.org/~tigran

--- select.c.0 Wed Jan 12 13:15:25 2000
+++ select.c Wed Jan 12 13:19:18 2000
@@ -11,6 +11,7 @@
  */
 
 #include <linux/malloc.h>
+#include <linux/vmalloc.h>
 #include <linux/smp_lock.h>
 #include <linux/poll.h>
 #include <linux/file.h>
@@ -403,7 +404,10 @@
         }
 
         size = nfds * sizeof(struct pollfd);
- fds = (struct pollfd *) kmalloc(size, GFP_KERNEL);
+ if (size > 131070) /* maximum that slab can allocate */
+ fds = (struct pollfd *) vmalloc(size);
+ else
+ fds = (struct pollfd *) kmalloc(size, GFP_KERNEL);
         if (!fds)
                 goto out;
 
@@ -424,7 +428,10 @@
                 err = -EINTR;
 
 out_fds:
- kfree(fds);
+ if (size > 131070)
+ vfree(fds);
+ else
+ kfree(fds);
 out:
         if (wait)
                 free_wait(wait_table);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jan 15 2000 - 21:00:20 EST