Configure grub.cfg for two CPU cores

From ESS-WIKI
Revision as of 10:44, 31 October 2023 by Winston.huang (talk | contribs) (Created page with "{{DISPLAYTITLE:Configure grub.cfg for two CPU cores}} <div style="float:right; position:fixed; margin:0 1em 0 0; top:200px; right:10px; max-height: 350px; overflow: auto...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
  • if two cpu cores ...
    GRUBCFG=/boot/efi/EFI/BOOT/grub.cfg
    # backup original grub.cfg if not backup before
    [[ ! -f $GRUBCFG.bak ]] && cp -a $GRUBCFG{,.bak} 
    
    # display current setting
    grep --color -E '(isolcpus|rcu_nocbs)=\S*' $GRUBCFG
    
    # change isolcpus=* rcu_nocbs=* to change isolcpus=1-2 rcu_nocbs=1-2
    sed -i "s/isolcpus=\S*/isolcpus=1-2/; s/rcu_nocbs=\S*/rcu_nocbs=1-2/" $GRUBCFG
    
    # verification
    grep --color -E '(isolcpus|rcu_nocbs)=\S*' $GRUBCFG
    
    # if the grub.cfg is correct, reboot machine
    reboot
    
  • recover to the original grub.cfg ...
    GRUBCFG=/boot/efi/EFI/BOOT/grub.cfg
    
    # display current setting
    grep --color -E '(isolcpus|rcu_nocbs)=\S*' $GRUBCFG
    
    # recover
    [[ -f $GRUBCFG.bak ]] && cp -a $GRUBCFG.bak $GRUBCFG
    
    # verification
    grep --color -E '(isolcpus|rcu_nocbs)=\S*' $GRUBCFG
    
    # if the grub.cfg is recovered, reboot machine
    reboot