mm_types.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef _LINUX_MM_TYPES_H
  2. #define _LINUX_MM_TYPES_H
  3. #include <linux/types.h>
  4. #include <linux/threads.h>
  5. #include <linux/list.h>
  6. #include <linux/spinlock.h>
  7. struct address_space;
  8. /*
  9. * Each physical page in the system has a struct page associated with
  10. * it to keep track of whatever it is we are using the page for at the
  11. * moment. Note that we have no way to track which tasks are using
  12. * a page, though if it is a pagecache page, rmap structures can tell us
  13. * who is mapping it.
  14. */
  15. struct page {
  16. unsigned long flags; /* Atomic flags, some possibly
  17. * updated asynchronously */
  18. atomic_t _count; /* Usage count, see below. */
  19. atomic_t _mapcount; /* Count of ptes mapped in mms,
  20. * to show when page is mapped
  21. * & limit reverse map searches.
  22. */
  23. union {
  24. struct {
  25. unsigned long private; /* Mapping-private opaque data:
  26. * usually used for buffer_heads
  27. * if PagePrivate set; used for
  28. * swp_entry_t if PageSwapCache;
  29. * indicates order in the buddy
  30. * system if PG_buddy is set.
  31. */
  32. struct address_space *mapping; /* If low bit clear, points to
  33. * inode address_space, or NULL.
  34. * If page mapped as anonymous
  35. * memory, low bit is set, and
  36. * it points to anon_vma object:
  37. * see PAGE_MAPPING_ANON below.
  38. */
  39. };
  40. #if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
  41. spinlock_t ptl;
  42. #endif
  43. };
  44. pgoff_t index; /* Our offset within mapping. */
  45. struct list_head lru; /* Pageout list, eg. active_list
  46. * protected by zone->lru_lock !
  47. */
  48. /*
  49. * On machines where all RAM is mapped into kernel address space,
  50. * we can simply calculate the virtual address. On machines with
  51. * highmem some memory is mapped into kernel virtual memory
  52. * dynamically, so we need a place to store that address.
  53. * Note that this field could be 16 bits on x86 ... ;)
  54. *
  55. * Architectures with slow multiplication can define
  56. * WANT_PAGE_VIRTUAL in asm/page.h
  57. */
  58. #if defined(WANT_PAGE_VIRTUAL)
  59. void *virtual; /* Kernel virtual address (NULL if
  60. not kmapped, ie. highmem) */
  61. #endif /* WANT_PAGE_VIRTUAL */
  62. };
  63. #endif /* _LINUX_MM_TYPES_H */