lkml.org 
[lkml]   [2017]   [Oct]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v16 3/5] virtio-balloon: VIRTIO_BALLOON_F_SG
From
Date
Wei Wang wrote:
> > And even if we could remove balloon_lock, you still cannot use
> > __GFP_DIRECT_RECLAIM at xb_set_page(). I think you will need to use
> > "whether it is safe to wait" flag from
> > "[PATCH] virtio: avoid possible OOM lockup at virtballoon_oom_notify()" .
>
> Without the lock being held, why couldn't we use __GFP_DIRECT_RECLAIM at
> xb_set_page()?

Because of dependency shown below.

leak_balloon()
xb_set_page()
xb_preload(GFP_KERNEL)
kmalloc(GFP_KERNEL)
__alloc_pages_may_oom()
Takes oom_lock
out_of_memory()
blocking_notifier_call_chain()
leak_balloon()
xb_set_page()
xb_preload(GFP_KERNEL)
kmalloc(GFP_KERNEL)
__alloc_pages_may_oom()
Fails to take oom_lock and loop forever

By the way, is xb_set_page() safe?
Sleeping in the kernel with preemption disabled is a bug, isn't it?
__radix_tree_preload() returns 0 with preemption disabled upon success.
xb_preload() disables preemption if __radix_tree_preload() fails.
Then, kmalloc() is called with preemption disabled, isn't it?
But xb_set_page() calls xb_preload(GFP_KERNEL) which might sleep with
preemption disabled.

\
 
 \ /
  Last update: 2017-10-10 15:10    [W:0.068 / U:2.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site