# What is legacy_va_layout

## eje211

This comes a post on games forum. I need to switch legacy_va_layout on, but it doesn't seem to exist on my system. Neither of the following two methods work:

```
# echo 1 > /proc/sys/vm/legacy_va_layout

-bash: /proc/sys/vm/legacy_va_layout: No such file or directory

# sysctl -w vm.legacy_va_layout=1

error: "vm.legacy_va_layout" is an unknown key
```

I understand somthing is missing from my kernel but I couldn't find any reference to anything like this in my /usr/src/linux/.config. I've googled for hours, trying to figure this out. I've look at all the patches I could find on the net but I can't find anything that seems to relate to legacy_va_layout. I don't really want to compile things at random in my kernel. What is this thing and how can I turn it on?

Thanks to anyone who can help.

----------

## steveb

I have it on my 2.6.12-rc3 system:

```
gentoo / # ls -1 /proc/sys/vm/

block_dump

dirty_background_ratio

dirty_expire_centisecs

dirty_ratio

dirty_writeback_centisecs

hugetlb_shm_group

laptop_mode

legacy_va_layout

lowmem_reserve_ratio

max_map_count

min_free_kbytes

nr_hugepages

nr_pdflush_threads

overcommit_memory

overcommit_ratio

page-cluster

swap_token_timeout

swappiness

vfs_cache_pressure

gentoo / #
```

Using grep to find any reference to it showed this:

```
gentoo / # grep -i -R legacy_va_layout /usr/src/linux-2.6.12-rc3/*

/usr/src/linux-2.6.12-rc3/Documentation/filesystems/proc.txt:legacy_va_layout

/usr/src/linux-2.6.12-rc3/System.map:c043da20 B sysctl_legacy_va_layout

/usr/src/linux-2.6.12-rc3/arch/i386/mm/mmap.c:  if (sysctl_legacy_va_layout ||

Binary file /usr/src/linux-2.6.12-rc3/arch/i386/mm/mmap.o matches

Binary file /usr/src/linux-2.6.12-rc3/arch/i386/mm/built-in.o matches

Binary file /usr/src/linux-2.6.12-rc3/arch/i386/boot/compressed/vmlinux.bin matches

/usr/src/linux-2.6.12-rc3/arch/ppc64/mm/mmap.c: return sysctl_legacy_va_layout;

/usr/src/linux-2.6.12-rc3/arch/s390/mm/mmap.c:  return sysctl_legacy_va_layout ||

/usr/src/linux-2.6.12-rc3/include/linux/mm.h:extern int sysctl_legacy_va_layout;

/usr/src/linux-2.6.12-rc3/include/linux/mm.h:#define sysctl_legacy_va_layout 0

/usr/src/linux-2.6.12-rc3/include/linux/sysctl.h:       VM_LEGACY_VA_LAYOUT=27, /* legacy/compatibility virtual address space layout */

/usr/src/linux-2.6.12-rc3/include/asm-i386/page.h:extern int sysctl_legacy_va_layout;

/usr/src/linux-2.6.12-rc3/include/asm/page.h:extern int sysctl_legacy_va_layout;

/usr/src/linux-2.6.12-rc3/kernel/sysctl.c:int sysctl_legacy_va_layout;

/usr/src/linux-2.6.12-rc3/kernel/sysctl.c:              .ctl_name       = VM_LEGACY_VA_LAYOUT,

/usr/src/linux-2.6.12-rc3/kernel/sysctl.c:              .procname       = "legacy_va_layout",

/usr/src/linux-2.6.12-rc3/kernel/sysctl.c:              .data           = &sysctl_legacy_va_layout,

/usr/src/linux-2.6.12-rc3/kernel/sysctl.c:              .maxlen         = sizeof(sysctl_legacy_va_layout),

Binary file /usr/src/linux-2.6.12-rc3/kernel/sysctl.o matches

Binary file /usr/src/linux-2.6.12-rc3/kernel/built-in.o matches

Binary file /usr/src/linux-2.6.12-rc3/vmlinux matches

gentoo / #
```

Looks like something in mmap code.

cheers

SteveB

----------

## eje211

I've added

```
#define HAVE_ARCH_PICK_MMAP_LAYOUT
```

to my kernel. It looked like it was missing but then the compilation failed. I'll look more into it later.

----------

## steveb

i don't have that entry as well:

```
gentoo / # grep -i HAVE_ARCH_PICK_MMAP_LAYOUT /usr/src/linux-2.6.12-rc3/.config

gentoo / #
```

but i have those mmap entries:

```
gentoo / # grep -i MMAP /usr/src/linux-2.6.12-rc3/.config

CONFIG_PACKET_MMAP=y

CONFIG_HPET_MMAP=y

gentoo / #
```

cheers

SteveB

----------

