All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Grover <agrover@redhat.com>
To: Xiubo Li <lixiubo@cmss.chinamobile.com>,
	nab@linux-iscsi.org, mchristi@redhat.com, shli@kernel.org
Cc: hch@lst.de, sheng@yasker.org, namei.unix@gmail.com,
	bart.vanassche@sandisk.com, linux-scsi@vger.kernel.org,
	target-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jianfei Hu <hujianfei@cmss.chinamobile.com>
Subject: Re: [PATCH] target/user: Add daynmic growing data area featuresupport
Date: Fri, 24 Feb 2017 14:29:00 -0800	[thread overview]
Message-ID: <21d93bec-a717-5157-8dcf-cc629611572f@redhat.com> (raw)
In-Reply-To: <48b49493-4c82-3ed5-126f-2ea18c701242@cmss.chinamobile.com>

On 02/23/2017 06:07 PM, Xiubo Li wrote:
>> Cool. This is a good approach for an initial patch but this raises
>> concerns about efficiently managing kernel memory usage -- the data area
>> grows but never shrinks, and total possible usage increases per
>> backstore. (What if there are 1000?) Any ideas how we could also improve
>> these aspects of the design? (Global TCMU data area usage limit?)
> Two ways in my mind:
> 
> The first:
> How about by setting a threshold cmd(SHRINK cmd), something likes
> the PAD cmd, to tell the userspace runner try to shrink the memories?

Why should userspace need to know if the kernel is shrinking memory
allocated to the data area? Userspace knows about memory described in
iovecs for in-flight cmds, we shouldn't need its cooperation to free
other allocated parts of the data area.

But, We likely don't want to release memory from the data area anyways
while active, in any case. How about if we set a timer when active
commands go to zero, and then reduce data area to some minimum if no new
cmds come in before timer expires?

> When the runner get the SHRINK cmd, it will try to remmap uio0's ring
> buffer(?). Then the kernel will get chance to shrink the memories....
> 
> The second:
> Try to extern the data area by using /dev/uio1, we could remmap the
> uio1 device when need, so it will be easy to get a chance to shrink the
> memories in uio1.

Userspace should not need to remap the region in order for the kernel to
free and unmap pages from the region.

The only thing we need to watch out for is if blocks are referenced by
in-flight cmds, we can't free them or userspace will segfault. So, if we
wait until there are no in-flight cmds, then it follows that the kernel
can free whatever it wants and userspace will not segfault.

-- Andy

  reply	other threads:[~2017-02-24 22:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-17  9:24 [PATCH] target/user: Add daynmic growing data area feature support lixiubo
2017-02-22 20:32 ` Andy Grover
2017-02-24  2:07   ` [PATCH] target/user: Add daynmic growing data area featuresupport Xiubo Li
2017-02-24 22:29     ` Andy Grover [this message]
2017-02-27  5:59       ` Xiubo Li
2017-02-27 19:32         ` how to unmap pages in an anonymous mmap? Andy Grover
2017-02-27 19:32           ` Andy Grover
2017-03-10  1:45           ` Xiubo Li
2017-03-10  1:45             ` Xiubo Li
2017-03-10  1:45             ` Xiubo Li
2017-02-27 23:56   ` [PATCH] target/user: Add daynmic growing data area feature support Mike Christie
2017-02-28  1:22     ` [PATCH] target/user: Add daynmic growing data area featuresupport Xiubo Li
2017-02-28 18:13       ` Mike Christie
2017-03-01  1:22         ` Xiubo Li
2017-02-28  9:13     ` Xiubo Li
2017-03-01 10:53   ` Xiubo Li

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=21d93bec-a717-5157-8dcf-cc629611572f@redhat.com \
    --to=agrover@redhat.com \
    --cc=bart.vanassche@sandisk.com \
    --cc=hch@lst.de \
    --cc=hujianfei@cmss.chinamobile.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=lixiubo@cmss.chinamobile.com \
    --cc=mchristi@redhat.com \
    --cc=nab@linux-iscsi.org \
    --cc=namei.unix@gmail.com \
    --cc=sheng@yasker.org \
    --cc=shli@kernel.org \
    --cc=target-devel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.