# Badram and memmap what's better?

## R. Bosch

Hi,

For a while I've been using the badram-patch on the suspend2-sources (manually applied) and works just fine.

Recently I looked for a reason why the patch still hasn't made it to the main sources or even the gentoo patchset. Then I saw this posting which states that - in his opinion - badram is obsolete. In staid we should be using memmap. For instance in my case, I have a memory fault at 0x01b1fdd0 or at 27.9MB according to memtest86+.

Thus I added the following option to the parameters for my kernel:

```
memmap=1M$27M
```

To reserve 1MB on the location where fault aught to be.

I used to use:

```
mem=2G badram=0x01b1fdd0,0xfffffffc
```

My question to you is, if there are other people that use this option with success?

And if this works, why persist on the badram patch for so long? Aside from pride in a project of course  :Wink: 

----------

## frostschutz

I used the badram patch years ago to make a PC router with a bad ram module run stable, and it worked great. First time I hear of the memmap parameter, how long has it been around? Anything that will prevent a region of memory to be accessed at all will work. Badram does just the same thing, it reserves memory. If the kernel can do that by itself now everything is fine and you can use that instead. However, in case of my PC router, if the badram patch is still around, I'd probably would continue using it, because of a) good experience with it and b) no need to find new settings that do the same for memmap as they do with badram currently.

----------

## R. Bosch

The thing is, that I don't  like the idea of adding code that could - potentially - break something. This patch is kept outside the kernel for years and now I got a potentially working alternative. You got a system you hardly give an update, so it makes sense. I have a desktop (well, laptop) and update once a week or two weeks. Take into account one might switch kernels every two months and you might like to stick to the kernels internals as much as possible.

Aside from the nice memtest86 feature of showing you the badram mapping, I'd like to know if there's any merit?

One objection would be the fact that I can't check if the address is accessible - and thus test if I have the right address masked/reserved. Badram does show you.

Anyone know a nice way?

----------

## frostschutz

Uh, well, in my case I'd see wether it works or not, because with a non badram/memmapped kernel the machine would simply crash every 15-30 minutes. Linux tends to crash quickly on bad ram because it tries to utilize as much RAM as possible at all times (for file system cache etc). And no, if the kernel inbuilt feature works for you, of course there is no reason to patch at all. Unless your RAM gets worse over time, the badram / memmap setting is something you put once into your list of kernel parameters and then forget.  :Smile: 

----------

## R. Bosch

Ok, I did some testing, and have come tot the conclusion that memmap does not work. Does anyone know what I might have done wrong? Isn't the address given representative to the 27M given to memmap?

I keep getting Badpage reports (not with badram)

```
page:c1b1fdc0 flags:0x80000000 mapping:00000001 mapcount:0 count:0
```

It is very consistent the past year.

Calculated, I take the 0x1b1fdc0 (ommit the first c) and come to 27.1245MB.

Thanks!

----------

## linuxtuxhellsinki

 *frostschutz wrote:*   

>  First time I hear of the memmap parameter, how long has it been around? 

 

Long time,  cause I had to use it when installing Gentoo on Proliant 1500 & 2500 models (dual P150 & PPro200)   :Wink: 

----------

