All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] calculate NGROUPS_PER_BLOCK from PAGE_SIZE
@ 2004-05-11 17:49 Greg Edwards
  2004-05-12  0:23 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Greg Edwards @ 2004-05-11 17:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: thockin

On ia64, EXEC_PAGESIZE (max page size) is 65536, but the default page
size is 16k.  This results in NGROUPS_PER_BLOCK in include/linux/sched.h
being calculated incorrectly when the page size is anything other than
64k.  For example, on a 16k page size kernel, a setgroups() call with a
gidsetsize of 65536 will end up walking over memory since only 1/4 of
the needed pages were allocated for the blocks[] array in the group_info
struct.

Patch below calculates NGROUPS_PER_BLOCK from PAGE_SIZE instead.

Greg


===== include/linux/sched.h 1.210 vs edited =====
--- 1.210/include/linux/sched.h	Mon May 10 06:25:34 2004
+++ edited/include/linux/sched.h	Tue May 11 11:45:29 2004
@@ -352,7 +352,7 @@
 void exit_io_context(void);
 
 #define NGROUPS_SMALL		32
-#define NGROUPS_PER_BLOCK	((int)(EXEC_PAGESIZE / sizeof(gid_t)))
+#define NGROUPS_PER_BLOCK	((int)(PAGE_SIZE / sizeof(gid_t)))
 struct group_info {
 	int ngroups;
 	atomic_t usage;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-05-12  0:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-11 17:49 [PATCH] calculate NGROUPS_PER_BLOCK from PAGE_SIZE Greg Edwards
2004-05-12  0:23 ` Andrew Morton

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.