# Looking to optimize my kernel

## SP2340

Hello all,

I'm not good at optimizing the kernel, heck as far as that goes you could say I am still very green behind the ears and do not understand it very much or what to look for.

That being said I would like to ask for help optimizing my kernel to get the best performance out of it?  I used to setup the system using genkernel but would like to get away from that so this system genkernel wasn't used.

I use Virtualbox and software raid.  The system is booted using UEFI.  lm-sensors doesn't seem to work which I would like to get working.

I can supply you with anything you need just ask.  I want to thank everyone for their help.

My system looks as follows:

Present Kernel Config

Present Dmesg

Hardware List

PCI List

Kernel build options

Disk Layout

I did get some help and this is what I was left with that didn't boot:

New Kernel Config

DMESG Log

Debug Log

----------

## NeddySeagoon

SP2340,

Tell us about your initrd too and tell the raid superblock version you used when you made your raid sets. 

```
[    1.355341] md: Autodetecting RAID arrays.

[    1.355697] md: autorun ...

[    1.356063] md: ... autorun DONE.
```

tells that raid autodetect failed to find you raid set(s).

Is root on raid?

```
[    1.373042] VFS: Mounted root (ext4 filesystem) readonly on device 259:4.
```

It seems not.

Optimising your kernel is overrated.  You can save build time, disk space and reduce the attack surface by leaving out things you don't need but none of that contributes to performance.

The kernel provides services and arbitrates resources for user processes.  Its rarely a bottleneck for getting the job done so its the wrong place to focus on for performance improvements unless you have a very rare use case.

----------

## SP2340

 *NeddySeagoon wrote:*   

> Tell us about your initrd too and tell the raid superblock version you used when you made your raid sets. 
> 
> ```
> [    1.355341] md: Autodetecting RAID arrays.
> 
> ...

 

Raid is used for my secondary backups and isn't always connected.  Its off on a USB connection that I only connect to backup my backup disk which is internal.

 *Quote:*   

> 
> 
> Is root on raid?
> 
> ```
> ...

 

Nope as stated above.

 *Quote:*   

> Optimising your kernel is overrated.  You can save build time, disk space and reduce the attack surface by leaving out things you don't need but none of that contributes to performance.
> 
> The kernel provides services and arbitrates resources for user processes.  Its rarely a bottleneck for getting the job done so its the wrong place to focus on for performance improvements unless you have a very rare use case.

 

I'm looking fro a smooth running system.  Do you believe what is already configured is enough?

Thanks for you feed back.

----------

## NeddySeagoon

SP2340,

Software raid over USB ... Ewww.

Over USB 3 with USB attached SCSI ... maybe.  Anything else is too unreliable for raid.

Thats

```
# CONFIG_USB_UAS is not set
```

is the kernel and your USB hardware needs to support it too (both ends).

You don't have the hardware to need

```
CONFIG_SND_INTEL8X0=y

CONFIG_SND_INTEL8X0M=y
```

Thats for Intel PC 97 sound. Instead you need 

CONFIG_SND_HDA=y and the codecs to suit your hardware.

```
CONFIG_PCCARD=y

CONFIG_PCMCIA=y

CONFIG_CARDBUS=y
```

PCMCIA is a very old slot used by laptops. It folds a PCI slot onto a lot less pins by multiplexing several signals onto the the same pin, at the expense of speed. PCCARD and CARDBUS were later but still obsolete incarnations of PCMCIA.  You don't have any of these.

These things are harmless to your kernel performance.  They take time to build, occupy hard drive space but other than being initialised when the kernel starts, the code is never used.   

Turning off the above will make 

```
CONFIG_YENTA=y

CONFIG_YENTA_O2=y

CONFIG_YENTA_RICOH=y

CONFIG_YENTA_TI=y

CONFIG_YENTA_ENE_TUNE=y

CONFIG_YENTA_TOSHIBA=y

CONFIG_PCCARD_NONSTATIC=y
```

 go away too.

Are you actually using IPv6  

```
CONFIG_IPV6=y
```

 ?

If not you don't need that option nor the USE=ipv6 flag.

If you are using IPv6 you need at least a boundary IPv6 firewall too as all IPv6 addresses beginning with a 2 are global.

IPv6 and IPv4 are totally separate. 

```
$ ifconfig

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.100.20  netmask 255.255.255.0  broadcast 192.168.100.255

        inet6 2a02:8010:*:*:*:*:*:*  prefixlen 64  scopeid 0x0<global>

        inet6 fe80::2e0:4cff:fe69:1509  prefixlen 64  scopeid 0x20<link>
```

If your ISP turns on IPv6 one day, you need to be ready, either by not using it or having your IPv6 firewall in place.

You can turn off IPv4 and IPv6 firewall options if you don't need a firewall on this system.

There is probably more but none of this will affect performance. Its just there but not used.

----------

## nokilli

```
make defconfig
```

 is your friend.

Seriously, I could have saved myself many days of screwing around with settings I'll never fully understand in a million years if only I had bothered to read the README that's sitting right there when you cd into /usr/src/linux.

The other tip: Rome wasn't built in a day.  So how on earth can your kernel possibly be?  Once you get it working, it's beer time.  You can always live without graphics or USB until tomorrow or Thursday at the very latest.  Make changes one at a time.  The kernel will backup your config files if you let it (make install).  Hare vs. tortoise.

----------

## SP2340

 *NeddySeagoon wrote:*   

> 
> 
> Software raid over USB ... Ewww.
> 
> Over USB 3 with USB attached SCSI ... maybe.  Anything else is too unreliable for raid.

 

It is attached using USB 3.  This raid is just a secondary backup system and it seems to be working, slow due to USB but working.

 *Quote:*   

> Thats
> 
> ```
> # CONFIG_USB_UAS is not set
> ```
> ...

 

I'm not finding this in the menuconfig

 *Quote:*   

> You don't have the hardware to need
> 
> ```
> CONFIG_SND_INTEL8X0=y
> 
> ...

 

Done

 *Quote:*   

> 
> 
> ```
> CONFIG_PCCARD=y
> 
> ...

 

Removed.

 *Quote:*   

> These things are harmless to your kernel performance.  They take time to build, occupy hard drive space but other than being initialised when the kernel starts, the code is never used.   
> 
> Turning off the above will make 
> 
> ```
> ...

 

Removed

 *Quote:*   

> Are you actually using IPv6  
> 
> ```
> CONFIG_IPV6=y
> ```
> ...

 

I'm leaving IPv6 in there as I want to play with it and learn it at some point in time.

Thank you for your pointers.

----------

## SP2340

 *nokilli wrote:*   

> 
> 
> ```
> make defconfig
> ```
> ...

 

I cannot run a default kernel as things don't work, i.e., booting using UUID.

 *Quote:*   

> The other tip: Rome wasn't built in a day.  So how on earth can your kernel possibly be?  Once you get it working, it's beer time.  You can always live without graphics or USB until tomorrow or Thursday at the very latest.  Make changes one at a time.  The kernel will backup your config files if you let it (make install).  Hare vs. tortoise.

 

You are correct sir.  I have taken time in between the initial setup and now.  I've been installing things I use and getting the system to where I think it is good.  Now it's time to tackle the kernel.

I don't know a lot about Linux but I'm learning.  :Wink: 

----------

## NeddySeagoon

SP2340,

Booting using UUID requires an initrd as the userspace mount command is required to mount root.

The kernel can use PARTUUID without an initrd.

```
make defconfig
```

turns on lots of things you will never need.

There are other make targets to get you started. 

This method from 2005 is still correct.

You will need more coffee now as there are a lot more kernel options now that 12 years ago but the idea still holds.

----------

## SP2340

NeddySeagoon,

Thnx, I'll take a look at this link you provided.

----------

## NeddySeagoon

SP2340,

I won't tell you where CONFIG_USB_UAS is, I'll tell you how to find it.

Many kernel symbols are hidden in menuconfig as the things they depend on are off.

This in both a good thing and a bad thing.  When you make a kernel for an amd64 system, you don't want to see all the options that are only useful on arm.

They are there but hidden.

The down side is that you can't see all the symbols you do want and the search wont find them either.

The 'z' key is a toggle to show/hide all hidden symbols. It works unless there is a 'z' shortcut in the menu you are on.

Press z and search for  USB_UAS.

Read the help and find the Depends on:  That's a boolean statement that must evaluate to true before you can see and select  CONFIG_USB_UAS.

Apply this process recursively as the setting(s) you need to satisfy the Depends on: may be hidden too.

----------

