Skip to main content
deleted 707 characters in body
Source Link
sourcejedi
  • 53.5k
  • 23
  • 178
  • 336

FromOne document in the linked background material mentions mapping_set_unevictable(). It says it was used in two cases:

MARKING ADDRESS SPACES UNEVICTABLE

For facilities such as ramfs none of the pages attached to the address space may be evicted. To prevent eviction of any such pages, the AS_UNEVICTABLE address space flag is provided, and this can be manipulated by a filesystem using a number of wrapper functions:

  • void mapping_set_unevictable(struct address_space *mapping);

    Mark the address space as being completely unevictable.

  • void mapping_clear_unevictable(struct address_space *mapping);

    Mark the address space as being evictable.

  • int mapping_unevictable(struct address_space *mapping);

    Query the address space, and return true if it is completely unevictable.

These are currently used in two places in the kernel:

  1. By ramfs to mark the address spaces of its inodes when they are created, and this mark remains for the life of the inode.

  2. By SYSV SHM to mark SHM_LOCK'd address spaces until SHM_UNLOCK is called.

    Note that SHM_LOCK is not required to page in the locked pages if they're swapped out; the application must touch the pages manually if it wants to ensure they're in memory.

...and this It is now used byin a third callercase. It is applied to i915 graphics buffers, if they are mapped by the GPU:

https://elixir.bootlin.com/linux/v5.0.17/ident/mapping_set_unevictable

Referenced in 4 files:

"The Global Graphics Translation Table (GTT) [...] takes care of the address mapping from the GPU virtual address space to physical addresses.".

From the linked background material:

MARKING ADDRESS SPACES UNEVICTABLE

For facilities such as ramfs none of the pages attached to the address space may be evicted. To prevent eviction of any such pages, the AS_UNEVICTABLE address space flag is provided, and this can be manipulated by a filesystem using a number of wrapper functions:

  • void mapping_set_unevictable(struct address_space *mapping);

    Mark the address space as being completely unevictable.

  • void mapping_clear_unevictable(struct address_space *mapping);

    Mark the address space as being evictable.

  • int mapping_unevictable(struct address_space *mapping);

    Query the address space, and return true if it is completely unevictable.

These are currently used in two places in the kernel:

  1. By ramfs to mark the address spaces of its inodes when they are created, and this mark remains for the life of the inode.

  2. By SYSV SHM to mark SHM_LOCK'd address spaces until SHM_UNLOCK is called.

    Note that SHM_LOCK is not required to page in the locked pages if they're swapped out; the application must touch the pages manually if it wants to ensure they're in memory.

...and this is now used by a third caller. It is applied to i915 graphics buffers, if they are mapped by the GPU:

https://elixir.bootlin.com/linux/v5.0.17/ident/mapping_set_unevictable

Referenced in 4 files:

"The Global Graphics Translation Table (GTT) [...] takes care of the address mapping from the GPU virtual address space to physical addresses.".

One document in the background material mentions mapping_set_unevictable(). It says it was used in two cases:

  1. By ramfs to mark the address spaces of its inodes when they are created, and this mark remains for the life of the inode.

  2. By SYSV SHM to mark SHM_LOCK'd address spaces until SHM_UNLOCK is called.

    Note that SHM_LOCK is not required to page in the locked pages if they're swapped out; the application must touch the pages manually if it wants to ensure they're in memory.

It is now used in a third case. It is applied to i915 graphics buffers, if they are mapped by the GPU:

https://elixir.bootlin.com/linux/v5.0.17/ident/mapping_set_unevictable

Referenced in 4 files:

"The Global Graphics Translation Table (GTT) [...] takes care of the address mapping from the GPU virtual address space to physical addresses.".

Source Link
sourcejedi
  • 53.5k
  • 23
  • 178
  • 336

From the linked background material:

MARKING ADDRESS SPACES UNEVICTABLE

For facilities such as ramfs none of the pages attached to the address space may be evicted. To prevent eviction of any such pages, the AS_UNEVICTABLE address space flag is provided, and this can be manipulated by a filesystem using a number of wrapper functions:

  • void mapping_set_unevictable(struct address_space *mapping);

    Mark the address space as being completely unevictable.

  • void mapping_clear_unevictable(struct address_space *mapping);

    Mark the address space as being evictable.

  • int mapping_unevictable(struct address_space *mapping);

    Query the address space, and return true if it is completely unevictable.

These are currently used in two places in the kernel:

  1. By ramfs to mark the address spaces of its inodes when they are created, and this mark remains for the life of the inode.

  2. By SYSV SHM to mark SHM_LOCK'd address spaces until SHM_UNLOCK is called.

    Note that SHM_LOCK is not required to page in the locked pages if they're swapped out; the application must touch the pages manually if it wants to ensure they're in memory.

...and this is now used by a third caller. It is applied to i915 graphics buffers, if they are mapped by the GPU:

https://elixir.bootlin.com/linux/v5.0.17/ident/mapping_set_unevictable

Referenced in 4 files:

"The Global Graphics Translation Table (GTT) [...] takes care of the address mapping from the GPU virtual address space to physical addresses.".