akaros/scripts/spatch/linux/memory.cocci
<<
>>
Prefs
   1@@
   2@@
   3-GFP_ATOMIC
   4+0
   5
   6@@
   7@@
   8-GFP_KERNEL
   9+MEM_WAIT
  10
  11@@
  12@@
  13-GFP_WAIT
  14+MEM_WAIT
  15
  16@@
  17@@
  18-GFP_NOFS
  19+MEM_WAIT
  20
  21@@
  22@@
  23-__GFP_WAIT
  24+MEM_WAIT
  25
  26@@
  27expression SZ;
  28expression FL;
  29@@
  30-kzalloc(SZ, FL)
  31+kzmalloc(SZ, FL)
  32
  33@@
  34expression SZ;
  35expression CNT;
  36expression FL;
  37@@
  38-kcalloc(CNT, SZ, FL)
  39+kzmalloc((CNT) * (SZ), FL)
  40
  41// These are dangerous in Akaros.  If someone is using a page* for multiple
  42// pages, it's probably okay, but we should look closely.
  43@@
  44expression ADDR;
  45expression ORDER;
  46@@
  47-__free_pages(ADDR, ORDER)
  48+free_cont_pages(page2kva(ADDR), ORDER)
  49
  50@@
  51expression FLAGS;
  52expression ORDER;
  53@@
  54-alloc_pages(FLAGS, ORDER)
  55+kva2page(get_cont_pages(ORDER, FLAGS))
  56
  57@@
  58expression FLAGS;
  59@@
  60-__get_free_page(FLAGS)
  61+kpage_alloc_addr()
  62
  63@@
  64expression PG;
  65@@
  66-get_page(PG)
  67+get_page_wont_compile_use_mmap(PG)
  68
  69@@
  70expression PG;
  71@@
  72-put_page(PG)
  73+page_decref(PG)
  74
  75@@
  76struct page *page;
  77@@
  78-page->_count
  79+page->pg_kref.refcount
  80
  81@@
  82expression KVA;
  83@@
  84-virt_to_head_page(KVA)
  85+kva2page(KVA)
  86
  87@@
  88expression KVA;
  89@@
  90-virt_to_page(KVA)
  91+kva2page(KVA)
  92
  93@@
  94expression KVA;
  95@@
  96-virt_to_bus(KVA)
  97+PADDR(KVA)
  98