All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arvind Kandhare <arvind.kan@wipro.com>
To: manfreds <manfreds@colorfullife.com>,
	William Lee Irwin III <wli@holomorphy.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	akpm@digeo.com, "indou.takao" <indou.takao@jp.fujitsu.com>,
	Dave Jones <davej@suse.de>,
	Arvind Kandhare <arvind.kan@wipro.com>
Subject: [RFC][PATCH 2.5.70] Static tunable semvmx and semaem
Date: Fri, 06 Jun 2003 11:23:23 +0530	[thread overview]
Message-ID: <3EE02C53.1040800@wipro.com> (raw)

Hi,
Please find below patch(RFC) for implementing semvmx and semaem
as static tunable parameters.

These can be modified at boot time using command line interface.

Please comment/suggest.

cheers,
Arvind

diff -Naur linux-2.5.70/include/linux/sysctl.h linux-2.5.70.n/include/linux/sysctl.h
--- linux-2.5.70/include/linux/sysctl.h	Tue May 27 06:30:40 2003
+++ linux-2.5.70.n/include/linux/sysctl.h	Wed Jun  4 16:21:19 2003
@@ -130,6 +130,8 @@
  	KERN_PIDMAX=55, 
	/* int: PID # limit */
    	KERN_CORE_PATTERN=56,	/* string: pattern for core-file names */
  	KERN_PANIC_ON_OOPS=57,  /* int: whether we will panic on an oops */
+ 
KERN_SEMVMX=58,  	/* int: maximum limit on semval */
+ 
KERN_SEMAEM=59, 
	/* int: maximun limit on semaem */
  };


diff -Naur linux-2.5.70/init/main.c linux-2.5.70.n/init/main.c
--- linux-2.5.70/init/main.c	Tue May 27 06:30:25 2003
+++ linux-2.5.70.n/init/main.c	Wed Jun  4 16:19:46 2003
@@ -67,6 +67,9 @@

  extern char *linux_banner;

+extern unsigned int semvmx;
+extern unsigned int semaem;
+
  static int init(void *);

  extern void init_IRQ(void);
@@ -141,6 +144,29 @@

  __setup("maxcpus=", maxcpus);

+static int __init _semvmx(char *str)
+{
+ 
get_option(&str, &semvmx);
+ 
if(semvmx>65535 || semvmx <=0)
+ 
{
+ 
	semvmx=32767;
+ 
}
+ 
return 1;
+}
+__setup("semvmx=", _semvmx);
+
+static int __init _semaem(char *str)
+{
+ 
get_option(&str, &semaem);
+ 
if(semaem>32767 || semaem <=0)
+ 
{
+ 
	semaem=16384;
+ 
}
+ 
return 1;
+}
+__setup("semaem=", _semaem);
+
+
  static char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, };
  char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, };

diff -Naur linux-2.5.70/ipc/sem.c linux-2.5.70.n/ipc/sem.c
--- linux-2.5.70/ipc/sem.c	Tue May 27 06:30:38 2003
+++ linux-2.5.70.n/ipc/sem.c	Wed Jun  4 17:01:46 2003
@@ -102,6 +102,9 @@
  #define sc_semopm	(sem_ctls[2])
  #define sc_semmni	(sem_ctls[3])

+unsigned int semvmx=32767;
+int semaem=16384;
+
  static int used_sems;

  void __init sem_init (void)
@@ -280,7 +283,7 @@
  	 
	/*
  	 		 *	Exceeding the undo range is an error.
  	 
	 */
- 
		if (undo < (-SEMAEM - 1) || undo > SEMAEM)
+ 
		if (undo < (-semaem - 1) || undo > semaem)
  	 
	{
  	 
		/* Don't undo the undo */
  	 
		sop->sem_flg &= ~SEM_UNDO;
@@ -290,7 +293,7 @@
  		}
  		if (curr->semval < 0)
  	 
	goto would_block;
- 
	if (curr->semval > SEMVMX)
+ 
	if (curr->semval > semvmx)
  	 
	goto out_of_range;
  	}

@@ -482,7 +485,7 @@
  		seminfo.semmns = sc_semmns;
  		seminfo.semmsl = sc_semmsl;
  		seminfo.semopm = sc_semopm;
- 
	seminfo.semvmx = SEMVMX;
+ 
	seminfo.semvmx = semvmx;
  		seminfo.semmnu = SEMMNU;
  		seminfo.semmap = SEMMAP;
  		seminfo.semume = SEMUME;
@@ -492,7 +495,7 @@
  	 
	seminfo.semaem = used_sems;
  		} else {
  	 
	seminfo.semusz = SEMUSZ;
- 
		seminfo.semaem = SEMAEM;
+ 
		seminfo.semaem = semaem;
  		}
  		max_id = sem_ids.max_id;
  		up(&sem_ids.sem);
@@ -613,7 +616,7 @@
  		}

  		for (i = 0; i < nsems; i++) {
- 
		if (sem_io[i] > SEMVMX) {
+ 
		if (sem_io[i] > semvmx) {
  	 
		err = -ERANGE;
  	 
		goto out_free;
  	 
	}
@@ -672,7 +675,7 @@
  		int val = arg.val;
  		struct sem_undo *un;
  		err = -ERANGE;
- 
	if (val > SEMVMX || val < 0)
+ 
	if (val > semvmx || val < 0)
  	 
	goto out_unlock;

  		for (un = sma->undo; un; un = un->id_next)
diff -Naur linux-2.5.70/kernel/sysctl.c linux-2.5.70.n/kernel/sysctl.c
--- linux-2.5.70/kernel/sysctl.c	Tue May 27 06:30:23 2003
+++ linux-2.5.70.n/kernel/sysctl.c	Wed Jun  4 17:02:52 2003
@@ -79,6 +79,8 @@
  extern int msg_ctlmnb;
  extern int msg_ctlmni;
  extern int sem_ctls[];
+extern unsigned int  semvmx;
+extern int semaem;
  #endif

  #ifdef __sparc__
@@ -237,6 +239,10 @@
  	 0644, NULL, &proc_dointvec},
  	{KERN_SEM, "sem", &sem_ctls, 4*sizeof (int),
  	 0644, NULL, &proc_dointvec},
+ 
{KERN_SEMVMX, "semvmx", &semvmx, sizeof (int),
+ 
0444, NULL, &proc_dointvec},
+ 
{KERN_SEMAEM, "semaem", &semaem, sizeof (int),
+ 
0444, NULL, &proc_dointvec},
  #endif
  #ifdef CONFIG_MAGIC_SYSRQ
  	{KERN_SYSRQ, "sysrq", &sysrq_enabled, sizeof (int),



             reply	other threads:[~2003-06-06  5:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-06  5:53 Arvind Kandhare [this message]
2003-06-06  6:50 ` [RFC][PATCH 2.5.70] Static tunable semvmx and semaem William Lee Irwin III
2003-06-06  9:01   ` Arvind Kandhare
2003-06-06 13:12     ` William Lee Irwin III
2003-06-06 16:52 ` Manfred Spraul
  -- strict thread matches above, loose matches on Subject: below --
2003-06-06 15:02 Arvind Kandhare

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=3EE02C53.1040800@wipro.com \
    --to=arvind.kan@wipro.com \
    --cc=akpm@digeo.com \
    --cc=davej@suse.de \
    --cc=indou.takao@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfreds@colorfullife.com \
    --cc=wli@holomorphy.com \
    /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.