From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: Re: [PATCH 09/12] ring: introduce lockless ring buffer Date: Fri, 29 Jun 2018 15:44:25 +0800 Message-ID: References: <20180604095520.8563-1-xiaoguangrong@tencent.com> <20180604095520.8563-10-xiaoguangrong@tencent.com> <355310d0-a33d-dab1-1781-2de37dd648f7@redhat.com> <20180629072313-mutt-send-email-mst@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Cc: kvm@vger.kernel.org, mtosatti@redhat.com, Xiao Guangrong , qemu-devel@nongnu.org, peterx@redhat.com, dgilbert@redhat.com, wei.w.wang@intel.com, jiang.biao2@zte.com.cn, pbonzini@redhat.com To: "Michael S. Tsirkin" , Jason Wang Return-path: In-Reply-To: <20180629072313-mutt-send-email-mst@kernel.org> Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel2=m.gmane.org@nongnu.org Sender: "Qemu-devel" List-Id: kvm.vger.kernel.org On 06/29/2018 12:23 PM, Michael S. Tsirkin wrote: > On Thu, Jun 28, 2018 at 09:36:00PM +0800, Jason Wang wrote: >> >> >> On 2018年06月04日 17:55, guangrong.xiao@gmail.com wrote: >>> From: Xiao Guangrong >>> >>> Memory barrier is omitted here, please refer to the comment in the code. >>> >>> (1)https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/kfifo.h >>> (2)http://dpdk.org/doc/api/rte__ring_8h.html >>> >>> Signed-off-by: Xiao Guangrong >>> --- >> >> May I ask why you need a MPSC ring here? Can we just use N SPSC ring for >> submitting pages and another N SPSC ring for passing back results? >> >> Thanks > > Or just an SPSC ring + a lock. > How big of a gain is lockless access to a trivial structure > like the ring? > Okay, i will give a try. BTW, we tried to use a global ring + lock for input and lockless ring for input, the former did not show better performance. But we haven't tried to use global ring + lock for out yet.