From: Wei Wang <wei.w.wang@intel.com>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
virtio-dev@lists.oasis-open.org, linux-kernel@vger.kernel.org,
qemu-devel@nongnu.org, virtualization@lists.linux-foundation.org,
kvm@vger.kernel.org, linux-mm@kvack.org, mst@redhat.com,
mhocko@kernel.org, akpm@linux-foundation.org,
mawilcox@microsoft.com
Cc: aarcange@redhat.com, yang.zhang.wz@gmail.com,
liliang.opensource@gmail.com, willy@infradead.org,
amit.shah@redhat.com, quan.xu@aliyun.com,
cornelia.huck@de.ibm.com, pbonzini@redhat.com,
mgorman@techsingularity.net
Subject: Re: [PATCH v17 4/6] virtio-balloon: VIRTIO_BALLOON_F_SG
Date: Sat, 04 Nov 2017 19:09:23 +0800 [thread overview]
Message-ID: <59FD9FE3.5090409@intel.com> (raw)
In-Reply-To: <201711032025.HJC78622.SFFOMLOtFQHVJO@I-love.SAKURA.ne.jp>
On 11/03/2017 07:25 PM, Tetsuo Handa wrote:
> Wei Wang wrote:
>> @@ -164,6 +284,8 @@ static unsigned fill_balloon(struct virtio_balloon *vb, size_t num)
>> break;
>> }
>>
>> + if (use_sg && xb_set_page(vb, page, &pfn_min, &pfn_max) < 0)
> Isn't this leaking "page" ?
Right, thanks, will add __free_page(page) here.
>> @@ -184,8 +307,12 @@ static unsigned fill_balloon(struct virtio_balloon *vb, size_t num)
>>
>> num_allocated_pages = vb->num_pfns;
>> /* Did we get any? */
>> - if (vb->num_pfns != 0)
>> - tell_host(vb, vb->inflate_vq);
>> + if (vb->num_pfns) {
>> + if (use_sg)
>> + tell_host_sgs(vb, vb->inflate_vq, pfn_min, pfn_max);
> Please describe why tell_host_sgs() can work without __GFP_DIRECT_RECLAIM allocation,
> for tell_host_sgs() is called with vb->balloon_lock mutex held.
Essentially,
tell_host_sgs()-->send_balloon_page_sg()-->add_one_sg()-->virtqueue_add_inbuf(
, , num=1 ,,GFP_KERNEL)
won't need any memory allocation, because we always add one sg (i.e.
num=1) each time. That memory
allocation option is only used when multiple sgs are added (i.e. num >
1) and the implementation inside virtqueue_add_inbuf
need allocation of indirect descriptor table.
We could also add some comments above the function to explain a little
about this if necessary.
>
>
>> @@ -223,7 +353,13 @@ static unsigned leak_balloon(struct virtio_balloon *vb, size_t num)
>> page = balloon_page_dequeue(vb_dev_info);
>> if (!page)
>> break;
>> - set_page_pfns(vb, vb->pfns + vb->num_pfns, page);
>> + if (use_sg) {
>> + if (xb_set_page(vb, page, &pfn_min, &pfn_max) < 0)
> Isn't this leaking "page" ?
Yes, will make it:
if (xb_set_page(vb, page, &pfn_min, &pfn_max) < 0) {
balloon_page_enqueue(..., page);
break;
}
>
> If this is inside vb->balloon_lock mutex (isn't this?), xb_set_page() must not
> use __GFP_DIRECT_RECLAIM allocation, for leak_balloon_sg_oom() will be blocked
> on vb->balloon_lock mutex.
OK. Since the preload() doesn't need too much memory (< 4K in total),
how about GFP_NOWAIT here?
Best,
Wei
next prev parent reply other threads:[~2017-11-04 11:09 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1509696786-1597-1-git-send-email-wei.w.wang@intel.com>
2017-11-03 8:13 ` [PATCH v17 1/6] lib/xbitmap: Introduce xbitmap Wei Wang
2017-11-03 8:13 ` [PATCH v17 2/6] radix tree test suite: add tests for xbitmap Wei Wang
2017-11-03 8:13 ` [PATCH v17 3/6] mm/balloon_compaction.c: split balloon page allocation and enqueue Wei Wang
2017-11-03 8:13 ` [PATCH v17 4/6] virtio-balloon: VIRTIO_BALLOON_F_SG Wei Wang
2017-11-03 8:13 ` [PATCH v17 5/6] mm: support reporting free page blocks Wei Wang
2017-11-03 8:13 ` [PATCH v17 6/6] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ Wei Wang
[not found] ` <1509696786-1597-2-git-send-email-wei.w.wang@intel.com>
2017-11-03 10:55 ` [PATCH v17 1/6] lib/xbitmap: Introduce xbitmap Tetsuo Handa
[not found] ` <201711031955.FFE57823.VFLMFtFJSOOQHO@I-love.SAKURA.ne.jp>
2017-11-06 8:15 ` Wei Wang
[not found] ` <1509696786-1597-4-git-send-email-wei.w.wang@intel.com>
2017-11-03 10:59 ` [PATCH v17 3/6] mm/balloon_compaction.c: split balloon page allocation and enqueue Tetsuo Handa
[not found] ` <1509696786-1597-5-git-send-email-wei.w.wang@intel.com>
2017-11-03 11:25 ` [PATCH v17 4/6] virtio-balloon: VIRTIO_BALLOON_F_SG Tetsuo Handa
[not found] ` <201711032025.HJC78622.SFFOMLOtFQHVJO@I-love.SAKURA.ne.jp>
2017-11-04 11:09 ` Wei Wang [this message]
2017-11-04 11:28 ` Tetsuo Handa
[not found] ` <201711042028.EGB64074.FOLMHtFJVQOOFS@I-love.SAKURA.ne.jp>
2017-11-06 8:21 ` Wei Wang
[not found] ` <1509696786-1597-3-git-send-email-wei.w.wang@intel.com>
2017-11-06 17:00 ` [PATCH v17 2/6] radix tree test suite: add tests for xbitmap Matthew Wilcox
[not found] ` <20171106170000.GA1195@bombadil.infradead.org>
2017-11-29 14:20 ` Wei Wang
[not found] ` <1509696786-1597-7-git-send-email-wei.w.wang@intel.com>
2017-11-13 10:34 ` [PATCH v17 6/6] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ Wei Wang
[not found] ` <5A097548.8000608@intel.com>
2017-11-13 17:32 ` Michael S. Tsirkin
[not found] ` <20171113192309-mutt-send-email-mst@kernel.org>
2017-11-14 12:02 ` Wei Wang
[not found] ` <5A0ADB3B.4070407@intel.com>
2017-11-14 21:21 ` Michael S. Tsirkin
[not found] ` <20171114230805-mutt-send-email-mst@kernel.org>
2017-11-15 3:47 ` Wei Wang
[not found] ` <5A0BB8EE.4050402@intel.com>
2017-11-15 13:26 ` Michael S. Tsirkin
[not found] ` <20171115152307-mutt-send-email-mst@kernel.org>
2017-11-16 11:59 ` Wei Wang
2017-11-20 11:42 ` Wei Wang
2017-11-15 20:32 ` Michael S. Tsirkin
2017-11-16 13:27 ` [virtio-dev] " Wei Wang
[not found] ` <5A0D923C.4020807@intel.com>
2017-11-17 11:35 ` Wei Wang
[not found] ` <5A0EC967.5090407@intel.com>
2017-11-17 11:48 ` Wei Wang
2017-11-17 12:44 ` Michael S. Tsirkin
[not found] ` <20171117144253-mutt-send-email-mst@kernel.org>
2017-11-18 5:22 ` Wang, Wei W
[not found] ` <286AC319A985734F985F78AFA26841F73936A8E7@shsmsx102.ccr.corp.intel.com>
2017-11-19 15:11 ` Michael S. Tsirkin
2017-11-17 13:18 ` Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=59FD9FE3.5090409@intel.com \
--to=wei.w.wang@intel.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=amit.shah@redhat.com \
--cc=cornelia.huck@de.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=liliang.opensource@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mawilcox@microsoft.com \
--cc=mgorman@techsingularity.net \
--cc=mhocko@kernel.org \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=qemu-devel@nongnu.org \
--cc=quan.xu@aliyun.com \
--cc=virtio-dev@lists.oasis-open.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=willy@infradead.org \
--cc=yang.zhang.wz@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).