此内容没有您所选择的语言版本。

31.6. Setting Module Parameters


Like the kernel itself, modules can also take parameters that change their behavior. Most of the time, the default ones work well, but occasionally it is necessary or desirable to set custom parameters for a module. Because parameters cannot be dynamically set for a module that is already loaded into a running kernel, there are two different methods for setting them.
  1. Load a kernel module by running the modprobe command along with a list of customized parameters on the command line. If the module is already loaded, you need to first unload all its dependencies and the module itself using the modprobe -r command. This method allows you to run a kernel module with specific settings without making the changes persistent. See Section 31.6.1, “Loading a Customized Module - Temporary Changes” for more information.
  2. Alternatively, specify a list of the customized parameters in an existing or newly-created file in the /etc/modprobe.d/ directory. This method ensures that the module customization is persistent by setting the specified parameters accordingly each time the module is loaded, such as after every reboot or modprobe command. See Section 31.6.2, “Loading a Customized Module - Persistent Changes” for more information.

31.6.1. Loading a Customized Module - Temporary Changes

Sometimes it is useful or necessary to run a kernel module temporarily with specific settings. To load a kernel module with customized parameters for the current system session, or until the module is reloaded with different parameters, run modprobe in the following format as root:
~]# modprobe <module_name> [parameter=value]
where [parameter=value] represents a list of customized parameters available to that module. When loading a module with custom parameters on the command line, be aware of the following:
  • You can enter multiple parameters and values by separating them with spaces.
  • Some module parameters expect a list of comma-separated values as their argument. When entering the list of values, do not insert a space after each comma, or modprobe will incorrectly interpret the values following spaces as additional parameters.
  • The modprobe command silently succeeds with an exit status of 0 if it successfully loads the module, or the module is already loaded into the kernel. Thus, you must ensure that the module is not already loaded before attempting to load it with custom parameters. The modprobe command does not automatically reload the module, or alert you that it is already loaded.
The following procedure illustrates the recommended steps to load a kernel module with custom parameters on the e1000e module, which is the network driver for Intel PRO/1000 network adapters, as an example:

Procedure 31.1. Loading a Kernel Module with Custom Parameters

  1. Verify whether the module is not already loaded into the kernel by running the following command:
    ~]# lsmod|grep e1000e
    e1000e                236338  0 
    ptp                     9614  1 e1000e
    Note that the output of the command in this example indicates that the e1000e module is already loaded into the kernel. It also shows that this module has one dependency, the ptp module.
  2. If the module is already loaded into the kernel, you must unload the module and all its dependencies before proceeding with the next step. See Section 31.4, “Unloading a Module” for instructions on how to safely unload it.
  3. Load the module and list all custom parameters after the module name. For example, if you wanted to load the Intel PRO/1000 network driver with the interrupt throttle rate set to 3000 interrupts per second for the first, second and third instances of the driver, and Energy Efficient Ethernet (EEE) turned on [5], you would run, as root:
    ~]# modprobe e1000e InterruptThrottleRate=3000,3000,3000 EEE=1
    This example illustrates passing multiple values to a single parameter by separating them with commas and omitting any spaces between them.


[5] Despite what the example might imply, Energy Efficient Ethernet is turned on by default in the e1000e driver.
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.