History

mm: simplify ZONE_DEVICE page private data

Remove the clumsy hmm_devmem_page_{get,set}_drvdata helpers, and instead just access the page directly. Also make the page data a void pointer, and thus much easier to use.

Christoph Hellwig committed 7 years ago

Commit 8a164fe1 parent eee3ae44 files · +12 −48Browse files

Showing the changes to include/linux (2 of 4 files). Show all

Unified · Split

2 files
  1. include/linux/hmm.h +0 −32
  2. include/linux/mm_types.h +1 −1
include/linux/hmm.h+0−32
@@ -584,36 +584,4 @@ static inline void hmm_mm_destroy(struct mm_struct *mm) {} · 583 unmodified lines
584static inline void hmm_mm_init(struct mm_struct *mm) {}584static inline void hmm_mm_init(struct mm_struct *mm) {}
585#endif /* IS_ENABLED(CONFIG_HMM_MIRROR) */585#endif /* IS_ENABLED(CONFIG_HMM_MIRROR) */
586 586
587#if IS_ENABLED(CONFIG_DEVICE_PRIVATE)
588/*
589 * hmm_devmem_page_set_drvdata - set per-page driver data field
590 *
591 * @page: pointer to struct page
592 * @data: driver data value to set
593 *
594 * Because page can not be on lru we have an unsigned long that driver can use
595 * to store a per page field. This just a simple helper to do that.
596 */
597static inline void hmm_devmem_page_set_drvdata(struct page *page,
598 unsigned long data)
599{
600 page->hmm_data = data;
601}
602
603/*
604 * hmm_devmem_page_get_drvdata - get per page driver data field
605 *
606 * @page: pointer to struct page
607 * Return: driver data value
608 */
609static inline unsigned long hmm_devmem_page_get_drvdata(const struct page *page)
610{
611 return page->hmm_data;
612}
613#endif /* CONFIG_DEVICE_PRIVATE */
614#else /* IS_ENABLED(CONFIG_HMM) */
615static inline void hmm_mm_destroy(struct mm_struct *mm) {}
616static inline void hmm_mm_init(struct mm_struct *mm) {}
617#endif /* IS_ENABLED(CONFIG_HMM) */
618
619#endif /* LINUX_HMM_H */587#endif /* LINUX_HMM_H */
include/linux/mm_types.h+1−1
@@ -158,7 +158,7 @@ struct page { · 157 unmodified lines
158 struct { /* ZONE_DEVICE pages */158 struct { /* ZONE_DEVICE pages */
159 /** @pgmap: Points to the hosting device page map. */159 /** @pgmap: Points to the hosting device page map. */
160 struct dev_pagemap *pgmap;160 struct dev_pagemap *pgmap;
161 unsigned long hmm_data;161 void *zone_device_data;
162 unsigned long _zd_pad_1; /* uses mapping */162 unsigned long _zd_pad_1; /* uses mapping */
163 };163 };
164 164

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t