System Administration Guide

Chapter 66 Tuning Kernel Parameters (Tasks)

This chapter describes the procedures for tuning kernel parameters. This is a list of the step-by-step instructions in this chapter.

Listing the Kernel Parameters

Display the current kernel parameters values by using the sysdef -i command.


# sysdef -i
* Hostid
  53001b80
*
* sun4m Configuration
* Devices
	packages (driver not attached)
		disk-label (driver not attached)
	   deblocker (driver not attached)
  	obp-tftp (driver not attached)
              .
              .
              .
options, instance #0
aliases (driver not attached)
openprom (driver not attached)
iommu, instance #0
	sbus, instance #0
		espdma, instance #0
			esp, instance #0
				sd (driver not attached)
				st (driver not attached)
				      .
               .
               .

How to Change the Value of a Kernel Parameter

  1. Become superuser.

  2. Add a line to the /etc/system file in the form:


    set parameter=value
    
  3. Verify the kernel parameter change.


    # grep parameter /etc/system
    
  4. Reboot the system.

    The kernel parses the /etc/system file during autoconfiguration and overrides the default value for the parameters specified in this file.

Example--Changing the Value of a Kernel Parameter

The following line in the /etc/system file sets the value of the max_nprocs to 500 parameter.

set max_nprocs=500

How to Set the Value of a Kernel Module Variable

  1. Become superuser.

  2. Add a line to the /etc/system file in the form:


    set module_name:variable=value
    
  3. Verify the kernel module variable change.


    # grep module_name /etc/system
    
  4. Reboot the system.

    The kernel parses the /etc/system file during autoconfiguration and overrides the default value for the parameters specified in this file.

Example--Setting the Value of a Kernel Module Variable

The following line in the /etc/system file sets the value of the msginfo_msgmap parameter in the msgsys module to 150.

set msgsys:msginfo_msgmap=150  

Buffer Cache Parameters

The bufhwm parameter specifies the maximum size for buffer cache memory usage expressed in units of 1,000 bytes. The default is 2% of physical memory. Use sar(1M) to measure the buffer cache statistics.

UFS Parameters

Table 66-1 describes the tunable UFS parameters.

Table 66-1 Tunable UFS Parameters

Parameter 

Description 

ufs_ninode

Maximum size of the inode table (default = max_nprocs + 16 + maxusers+ 64)

ncsize

Number of dnlc entries (default = max_nprocs+16+maxusers + 64);

dnlc is the directory-name lookup cache.

STREAMS Parameters

Table 66-2 describes the tunable STREAMS parameters.

Table 66-2 Tunable STREAMS Parameters

Parameter 

Default 

Description 

nstrpush

9

The maximum number of STREAMS pushes allowed. 

strmsgsz

0

The maximum size for the STREAMS message that a user can create. A value of 0 indicates no upper bound. This parameter may disappear entirely in a future release.

strctlsz

1024

The maximum size of the ctl part of a message.

strthresh

0

The maximum amount of dynamic memory that the STREAMS subsystem can consume, in bytes. Once this threshold is passed, any pushes, opens, and writes on a STREAMS devices will fail for non-root processes. A value of 0 means no limit.

sadcnt

16

Number of sad devices.

Interprocess Communication (IPC) Parameters

Table 66-3 describes the tunable interprocess communication parameters.

Table 66-3 Interprocess Communication Parameters

Parameter 

Default 

Description 

Message Queue 

msginfo_msgmap

100 

Number of entries in the message map 

msginfo_msgmax

2048 

Maximum message size  

msginfo_msgmnb

4096 

Maximum bytes on queue  

msginfo_msgmni

50 

Number of message queue identifiers  

msginfo_msgssz

Segment size of a message (should be a multiple of the word size) 

msginfo_msgtql

40

Number of system message headers  

msginfo_msgseg

1024

Number of message segments (must be < 32768) 

Semaphore Facility 

seminfo_semmap

10

Number of entries in the semaphore map  

seminfo_semmni

10

Number of semaphore identifiers  

seminfo_semmns

60

Number of semaphores in the system  

seminfo_semmnu

30

Number of processes using the undo facility

seminfo_semmsl

25

Maximum number of semaphores, per id

seminfo_semopm

10

Maximum number of operations, per semaphore call  

seminfo_semume

10

Maximum number of undo structures per process

Note: The total number of undo structures allocated in the system is:

seminfo_semmnu * seminfo_semume

seminfo_semvmx

32767

Semaphore maximum value 

seminfo_semaem

16384

Maximum value for adjustment on exit 

Shared Memory 

shminfo_shmmax

1048576

Maximum shared memory segment size  

shminfo_shmmin

1

Minimum shared memory segment size  

shminfo_shmmni

100

Number of shared memory identifiers  

shminfo_shmseg

6

Segments, per process 

How to Tune the Interprocess Communication Parameters

  1. Become superuser.

  2. Add a line to the /etc/system file using the syntax described in Table 66-4.

    Table 66-4 Tuning Interprocess Communication Parameters

    Parameter Type 

    Parameter 

    Tuning Syntax 

    Message Queue

    msgsys

    set msgsys:msginfo_variable = value
    

    Semaphore Facility

    semsys

    set semsys:seminfo_variable=value
    

    Shared Memory

    shmsys

    set shmsys:shminfo_variable=value
    

  3. Verify the kernel parameter change.


    # grep parameter /etc/system
    
  4. Reboot the system.

    The kernel parses the /etc/system file during autoconfiguration and overrides the default value for the parameters specified in this file.

Memory Management Parameters

Table 66-5 describes the tunable memory management parameters.

Table 66-5 Memory Management Parameters

Parameter 

Default 

Description 

lotsfree

scaled based on physical memory 

If freemem drops below lotsfree, the system starts to steal pages from processes.

tune_t_fsflushr

30

Rate at which fsflush is run, in seconds

tune_t_minarmem

25

The minimum available resident (not swappable) memory needed to avoid deadlock, in pages 

tune_t_minasmem

25

The minimum available swappable memory needed to avoid deadlock, in pages 

tune_t_flckrec

512

The maximum number of active frlocks


Note -

Since the Solaris 2.4 release, the tune_t_gpgslo parameter has been replaced by a more complicated criteria for swapping based on the number of runnable threads.


The freemem parameter is defined in pages. Utilities like vmstat translates freemem into bytes from pages.

How to Tune Memory Management Parameters

  1. Become superuser.

  2. Add a line to the /etc/system file using the following syntax.


    set tune:variable=value
    
  3. Verify the kernel parameter change.


    # grep parameter /etc/system
    
  4. Reboot the system.

    The kernel parses the /etc/system file during autoconfiguration and overrides the default value for the parameters specified in this file.

Miscellaneous Parameters

Table 66-6 describes tunable miscellaneous parameters.

Table 66-6 Miscellaneous Parameter

Parameter 

Default 

Description 

lwp_default_stksize

8192

Size of the kernel stack for lwps. Do not adjust this value unless there is a kernel overflow. The value is expressed in bytes and must be a multiple of PAGESIZE bytes.

npty

48

Total number of 4.x pseudo-ttys configured 

pt_cnt

48

Total number of 5.x pseudo-ttys configured

How to Tune Miscellaneous Parameters

  1. Become superuser.

  2. Add a line to the /etc/system file using the following syntax.


    set parameter=value
    
  3. Verify the kernel parameter change.


    # grep parameter /etc/system
    
  4. Reboot the system.

    If you changed device related kernel parameters, you need to use the -r option when booting the system. When the system boots, the kernel parses the /etc/system file during autoconfiguration and overrides the default value for the parameters specified in this file.

Example--Tuning Miscellaneous Parameters

The following line in the /etc/system file sets the value of the pt_cnt parameter to 200.


set pt_cnt=200