Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

vmw_balloon: stop using the balloon_dev_info lock

Let's not piggy-back on the existing lock and use a separate lock for the
huge page list. Now that we use a separate lock, there is no need to
disable interrupts, so use the non-irqsave variants. We only required the
irqsave variants because of the balloon device lock.

This is a preparation for changing the locking used to protect
balloon_dev_info.

While at it, talk about "page migration" instead of "page compaction".
We'll change that in core code soon as well.

Link: https://lkml.kernel.org/r/20260119230133.3551867-8-david@kernel.org
Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Eugenio Pérez <eperezma@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Jerrin Shaji George <jerrin.shaji-george@broadcom.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: SeongJae Park <sj@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

David Hildenbrand (Red Hat) and committed by
Andrew Morton
c33b47c3 a00de9ba

+12 -8
+12 -8
drivers/misc/vmw_balloon.c
··· 354 354 /** 355 355 * @huge_pages - list of the inflated 2MB pages. 356 356 * 357 - * Protected by @b_dev_info.pages_lock . 357 + * Protected by @huge_pages_lock. 358 358 */ 359 359 struct list_head huge_pages; 360 + 361 + /** 362 + * @huge_pages_lock: lock for the list of inflated 2MB pages. 363 + */ 364 + spinlock_t huge_pages_lock; 360 365 361 366 /** 362 367 * @vmci_doorbell. ··· 992 987 unsigned int *n_pages, 993 988 enum vmballoon_page_size_type page_size) 994 989 { 995 - unsigned long flags; 996 990 struct page *page; 997 991 998 992 if (page_size == VMW_BALLOON_4K_PAGE) { ··· 999 995 } else { 1000 996 /* 1001 997 * Keep the huge pages in a local list which is not available 1002 - * for the balloon compaction mechanism. 998 + * for the balloon page migration. 1003 999 */ 1004 - spin_lock_irqsave(&b->b_dev_info.pages_lock, flags); 1000 + spin_lock(&b->huge_pages_lock); 1005 1001 1006 1002 list_for_each_entry(page, pages, lru) { 1007 1003 vmballoon_mark_page_offline(page, VMW_BALLOON_2M_PAGE); ··· 1010 1006 list_splice_init(pages, &b->huge_pages); 1011 1007 __count_vm_events(BALLOON_INFLATE, *n_pages * 1012 1008 vmballoon_page_in_frames(VMW_BALLOON_2M_PAGE)); 1013 - spin_unlock_irqrestore(&b->b_dev_info.pages_lock, flags); 1009 + spin_unlock(&b->huge_pages_lock); 1014 1010 } 1015 1011 1016 1012 *n_pages = 0; ··· 1037 1033 { 1038 1034 struct page *page, *tmp; 1039 1035 unsigned int i = 0; 1040 - unsigned long flags; 1041 1036 1042 1037 /* In the case of 4k pages, use the compaction infrastructure */ 1043 1038 if (page_size == VMW_BALLOON_4K_PAGE) { ··· 1046 1043 } 1047 1044 1048 1045 /* 2MB pages */ 1049 - spin_lock_irqsave(&b->b_dev_info.pages_lock, flags); 1046 + spin_lock(&b->huge_pages_lock); 1050 1047 list_for_each_entry_safe(page, tmp, &b->huge_pages, lru) { 1051 1048 vmballoon_mark_page_online(page, VMW_BALLOON_2M_PAGE); 1052 1049 ··· 1057 1054 1058 1055 __count_vm_events(BALLOON_DEFLATE, 1059 1056 i * vmballoon_page_in_frames(VMW_BALLOON_2M_PAGE)); 1060 - spin_unlock_irqrestore(&b->b_dev_info.pages_lock, flags); 1057 + spin_unlock(&b->huge_pages_lock); 1061 1058 *n_pages = i; 1062 1059 } 1063 1060 ··· 1831 1828 balloon.b_dev_info.migratepage = vmballoon_migratepage; 1832 1829 1833 1830 INIT_LIST_HEAD(&balloon.huge_pages); 1831 + spin_lock_init(&balloon.huge_pages_lock); 1834 1832 spin_lock_init(&balloon.comm_lock); 1835 1833 init_rwsem(&balloon.conf_sem); 1836 1834 balloon.vmci_doorbell = VMCI_INVALID_HANDLE;