Lines Matching refs:page_ext

5 #include <linux/page_ext.h>
48 * When need callback returns true, page_ext checks if there is a request for
50 * extra space is allocated for each page_ext entry and offset is returned to
111 page_ext_size = sizeof(struct page_ext);
139 static inline struct page_ext *get_entry(void *base, unsigned long index)
155 static struct page_ext *lookup_page_ext(const struct page *page)
159 struct page_ext *base;
165 * page can reach here before the page_ext arrays are
178 struct page_ext *base;
220 pr_info("allocated %ld bytes of page_ext\n", total_usage);
224 pr_crit("allocation of page_ext failed.\n");
229 static bool page_ext_invalid(struct page_ext *page_ext)
231 return !page_ext || (((unsigned long)page_ext & PAGE_EXT_INVALID) == PAGE_EXT_INVALID);
234 static struct page_ext *lookup_page_ext(const struct page *page)
238 struct page_ext *page_ext = READ_ONCE(section->page_ext);
243 * page can reach here before the page_ext arrays are
247 if (page_ext_invalid(page_ext))
249 return get_entry(page_ext, pfn);
271 struct page_ext *base;
276 if (section->page_ext)
283 * The value stored in section->page_ext is (base - pfn)
299 section->page_ext = (void *)base - page_ext_size * pfn;
323 struct page_ext *base;
326 if (!ms || !ms->page_ext)
329 base = READ_ONCE(ms->page_ext);
331 * page_ext here can be valid while doing the roll back
336 WRITE_ONCE(ms->page_ext, NULL);
348 if (!ms || !ms->page_ext)
350 val = (void *)ms->page_ext + PAGE_EXT_INVALID;
351 WRITE_ONCE(ms->page_ext, val);
396 * Freeing of page_ext is done in 3 steps to avoid
398 * 1) Traverse all the sections and mark their page_ext
400 * 2) Wait for all the existing users of page_ext who
402 * 3) Free the page_ext.
479 pr_info("allocated %ld bytes of page_ext\n", total_usage);
497 * Ensures that the page_ext will remain valid until page_ext_put()
500 * Return: NULL if no page_ext exists for this page.
504 struct page_ext *page_ext_get(struct page *page)
506 struct page_ext *page_ext;
509 page_ext = lookup_page_ext(page);
510 if (!page_ext) {
515 return page_ext;
520 * @page_ext: Page extended information received from page_ext_get().
528 void page_ext_put(struct page_ext *page_ext)
530 if (unlikely(!page_ext))