# Sensible desktop-focused defaults for kernel config

## jorgepeixoto

Is there anywhere I can get sensible desktop-focused defaults for kernel config?

The default configuration we get from gentoo-sources does not seem very sensible for a desktop. For a quick example, it comes with X86_GENERICARCH and CONFIG_CC_OPTIMIZE_FOR_SIZE, which are (AFAIK) not good for a desktop. 

The default config provided by genkernel is even worse, as it comes with CONFIG_CC_OPTIMIZE_FOR_SIZE as well as CONFIG_PREEMPT_NONE and CONFIG_HZ_100.

Is there anywhere I can find a kernel config that is a good start for a desktop system? So that I only have to add a few customizations to match my hardware? Ideally, I would make a few customizations in "Processor type and features" (set CONFIG_MK7, unset CONFIG_SMP and CONFIG_X86_GENERIC, set CONFIG_NOHIGHMEM), then go to "Device Drivers" and add support for my sound card, ethernet card, TV card and hardware monitoring chip.

Maybe one alternative would be to start with Ubuntu's config file, but this generates two problems:

1) I don't know about the patches Ubuntu applies; I don't know if it is really a good idea to use Ubuntu configuration on Gentoo

2) The Ubuntu config comes with nearly everything (server stuff, laptop stuff, embedded stuff...) enabled as modules, so some 400 MiB of modules get built. It would take a lot of work to comb the configuration and remove what I don't need. I would like a lightweight desktop-focused default config.

Thank you for your attention!

----------

## pappy_mcfae

For your consideration, here are two configs that are really trimmed to the bone, and as tweaked as I can get them with my present, yet ever expanding knowledge.

.copnfig_1 .config_2

These are both from laptop systems that are set up as desktop systems. Pick one (or both) and have fun!

Blessed be!

Pappy

----------

## jorgepeixoto

 *pappy_mcfae wrote:*   

> For your consideration, here are two configs that are really trimmed to the bone, and as tweaked as I can get them with my present, yet ever expanding knowledge.
> 
> .copnfig_1 .config_2
> 
> These are both from laptop systems that are set up as desktop systems. Pick one (or both) and have fun!
> ...

 

Well, do you have a more recent version? I use 2.6.24.

----------

## pappy_mcfae

Use make oldconfig, and that will "update" the config. You will then have to double check with either make xconfig or make menuconfig to make sure you're hardware is properly supported. Check with the Gentoo kernel upgrade guide for how to do it.

Blessed be!

Pappy

----------

## jorgepeixoto

 *pappy_mcfae wrote:*   

> Use make oldconfig, and that will "update" the config. You will then have to double check with either make xconfig or make menuconfig to make sure you're hardware is properly supported. Check with the Gentoo kernel upgrade guide for how to do it.
> 
> Blessed be!
> 
> Pappy

 

I know of make oldconfig; but it would be better to start with a more recent config.

Anyway, thank you. I may refer to these configs in the future.

I would love, though, to see a "more official" default config. Something made by a developer, or at least in a wiki (that is, a group of users). I think I will contact the genkernel developers and

1) Ask about the reasons for their weird choices (CONFIG_CC_OPTIMIZE_FOR_SIZE, CONFIG_PREEMPT_NONE, CONFIG_HZ_100)

2) Ask them to make their sample config separately available. It is bad to have to download 6.2MiB (the size of genkernel files) when I just want the config

3) Ask if they have a more trimmed down config.

----------

## pappy_mcfae

You are free to do as you wish...but if you are waiting for Mr. .config perfect, you may wait a while.

Blessed be!

Pappy

----------

## gerard27

jorgepeixoto,

It is impossible to produce .config that will be useful to all the hardware around.

pappya-mcfae's advice is the way to go.

This is not Windows!

You'll be asked some questions while doing make oldconfig.

Gerard.

----------

## cyrillic

 *jorgepeixoto wrote:*   

> I would love, though, to see a "more official" default config. Something made by a developer ...

 

If you want something official, do this

```
# cd /usr/src/linux

# make defconfig 
```

The problem is that whatever the kernel developers consider to be sensible may be quite different from what you or I consider to be sensible.

Your best bet is to just take the time to configure your own "default .config" from scratch, then every time you upgrade the kernel, you can use the defaults you saved last time.

----------

## pappy_mcfae

All of my configs began their lives in Slackware. I used the default 2.6 setup for Slackware-11 (2.6.18.13 (I think)), and have modified it over time as my knowledge of the kernel has grown. The .config I offered, if you work with it properly, can be tweaked to your hardware, and will require fewer tweaks than starting from scratch.

Be adventurous!

Blessed be!

Pappy

----------

## jorgepeixoto

 *Gerard van Vuuren wrote:*   

> jorgepeixoto,
> 
> It is impossible to produce .config that will be useful to all the hardware around.
> 
> 

 

Of course. I am saying it would be very convenient if we had desktop focused defaults to start with. Things like CONFIG_CC_OPTIMIZE_FOR_SIZE, CONFIG_PREEMPT_NONE and CONFIG_HZ_100 would come unset, as they are unsuited for desktops. It would become much easier to configure the kernel.

The way things are, it is hard and very time consuming to go through the huge kernel config and make something optimal.

It is quite easy to make something bootable, but very time consuming to make something optimal.

If we had a desktop focused default, though, it would be very easy and quick.

----------

## depontius

There seems to be some hatred toward CONFIG_CC_OPTIMIZE_FOR_SIZE for desktop machines, and IMHO it may be misdirected.  When you worry about optimizing for size, think not of the size of main memory and not at all about the size of the disk.  Think instead about the cache.  Quite often, optimizing for size lets the cpu cache things much more effectively, and turns out to be a better performance gain that other optimizations that might increase code size, thereby blowing the cache.  In particular, I would think that reduced-cache variants like Celeron and Sempron would be well suited for CONFIG_CC_OPTIMIZE_FOR_SIZE to be set, and it's not clear that it shouldn't be used on the regular lines, as well.  Ironically, laptops might be best able to leave CONFIG_CC_OPTIMIZE_FOR_SIZE unset, because the Centrino class of cpus have some incredibly large L2 caches - as big as 6 MB.  However in this case CONFIG_CC_OPTIMIZE_FOR_SIZE might have more to do with power consumption than performance, because the big cache is there to prevent the power expense of using main memory.

Incidentally, I use genkernel, but carefully manage my own configs.  It's simply easier to use genkernel than to have to type the commands in series.

----------

## jorgepeixoto

 *depontius wrote:*   

> There seems to be some hatred toward CONFIG_CC_OPTIMIZE_FOR_SIZE for desktop machines, and IMHO it may be misdirected. 

 

I'll not discuss that. That was just an example. Other quick examples are CONFIG_PREEMPT_NONE and CONFIG_HZ_100 (and I found these just by taking a quick look at the first kernel config menus).

----------

## jorgepeixoto

Can we at least collaborate on the page http://gentoo-wiki.com/HOWTO_Detailed_Kernel_Configuration so that it is more up to date and reasonably complete? I will help.

----------

## depontius

A couple of high (or is that low?) points that I have found:

If you're using XFS, don't use CONFIG_4KSTACKS.

I have also found some problems using CONFIG_PREEMPT with the nVidia binary blob drivers.

I'm under the impression that CONFIG_NO_HZ is pretty much always the way to go, (for power) assuming it works on your board, and for machines with someone sitting at the keyboard CONFIG_HZ_300/CONFIG_HZ=300 is good.  For a server 100HZ would have slightly less overhead.

I'd really like to see something that can use /proc/cpuinfo and lspci, along with a few general (desktop vs server, filesystems, etc.) preferences, and come up with a basic config for a machine.

----------

## jorgepeixoto

 *depontius wrote:*   

> A couple of high (or is that low?) points that I have found:
> 
> If you're using XFS, don't use CONFIG_4KSTACKS.
> 
> I have also found some problems using CONFIG_PREEMPT with the nVidia binary blob drivers.
> ...

 

I will add your suggestions to the wiki later when I have time. 

Everyone with similar remarks, please add them to the wiki or at least post them here, so I can add them.

And depontius, these warnings about CONFIG_4KSTACKS and CONFIG_PREEMPT apply to which kernel version?

 *depontius wrote:*   

> 
> 
> I'd really like to see something that can use /proc/cpuinfo and lspci, along with a few general (desktop vs server, filesystems, etc.) preferences, and come up with a basic config for a machine.

 

That would be wonderful. But it would already be very good if at least we can get some users to collaborate on  http://gentoo-wiki.com/HOWTO_Detailed_Kernel_Configuration.

----------

## depontius

The warning about 4KSTACKS has been there pretty much forever.  There are people trying hard to move to 4k stacks, because it makes kernel memory management easier and cleaner, but a few things just use too much stack space and don't play well with it, and XFS is the prime example.  Unfortunately I don't know any of the others.

As for PREEMPT, I think that's more of a problem with more recent kernels.  (I'm running gentoo-2.6.24-r :Cool:  They've been trying to either remove the Big Kernel Lock or at least make it preemptable for a long time.  At times those things become problematic, so finally Linus recently called a time-out to the preemptable stuff.  There's now a separate kernel tree dedicated to finally, once and for all, getting rid of the BKL, and as they do the work they're merging pieces of it into the mainline kernel.  Forcing it to be done cleanly is probably the right way, too.

Most of this information comes from my MythTV machine, which is perhaps a bit of a stress test, when it's recording something and then interactive users start working, too.

----------

## pappy_mcfae

I have added some stuff to the Wiki, and I will add more soon. I want to add a section on using make xconfig, since there are few references to it in most available literature. I also did a bit of rearranging so the progression was a little more logical. I also want to add a section called "Good ideas", for settings that should be used, either for security, performance, or both. 

Check it out and see what you think.

Blessed be!

Pappy

----------

