Linux-mm

  • Uploaded by: Neependra Khare
  • 0
  • 0
  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Linux-mm as PDF for free.

More details

  • Words: 231
  • Pages: 9
GeeP organized tutorial on

Linux-mm APIs : A brief tutorial Amey Inamdar Infrastructure sponsors: Oasis Technologies

A quick brushup • Virtual Memory • Paging

Virtual Memory Layout

Buddy/Zone allocator • Zones: – ZONE_DMA – ZONE_NORMAL – ZONE_HIGHMEM

0 – 16 MB 16-896 MB 896 MB onwards

• Buddy allocator – Working – APIs struct page * alloc_pages(gfp_t gfp_mask, unsigned int order); void free_pages(unsigned long addr, unsigned int order);

Vmalloc & Highmem • Page aligned virtually contiguous memory • Pages can be physically non-contiguous • APIs – void *vmalloc(unsigned long size); – void vfree(void *addr);

• Kmap & highmem – void *kmap(struct page *page); – void kunmap(struct page *page); – void *kmap_atomic(struct page *page, enum km_type type);

Slab allocator • What about small sized allocations e.g. for structure instances? • Layer which gets the pages from zone/buddy allocator and satisfies small sized allocations. • Brief working

Slab allocator (continued)

Slab Allocator - APIs •

struct kmem_cache * kmem_cache_create( const char *name, size_t size, size_t align, unsigned long flags; void (*ctor)(void*, struct kmem_cache *, unsigned long), void (*dtor)(void*, struct kmem_cache *, unsigned long));



void kmem_cache_destroy( struct kmem_cache *cachep );



void kmem_cache_alloc( struct kmem_cache *cachep, gfp_t flags );



void kmem_cache_free( struct kmem_cache *cachep, void *objp );

Slab allocator - APIs • General purpose cache • APIs – void *kmalloc( size_t size, int flags ); – void kfree( const void *objp );

More Documents from "Neependra Khare"

Effective Use Of Gdb
November 2019 19
Linux-mm
November 2019 15
Kvm-way
November 2019 20
Geep Gdb Basics 24thfeb08
November 2019 17
Linux Kernel Programming
November 2019 26
Linux Threads
November 2019 12