From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757231AbdLQLuJ convert rfc822-to-8bit (ORCPT ); Sun, 17 Dec 2017 06:50:09 -0500 Received: from mga04.intel.com ([192.55.52.120]:52215 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753273AbdLQLuH (ORCPT ); Sun, 17 Dec 2017 06:50:07 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,415,1508828400"; d="scan'208";a="3413359" From: "Wang, Wei W" To: Tetsuo Handa , "willy@infradead.org" CC: "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" , "david@redhat.com" , "cornelia.huck@de.ibm.com" , "mgorman@techsingularity.net" , "aarcange@redhat.com" , "amit.shah@redhat.com" , "pbonzini@redhat.com" , "liliang.opensource@gmail.com" , "yang.zhang.wz@gmail.com" , "quan.xu@aliyun.com" , "nilal@redhat.com" , "riel@redhat.com" Subject: RE: [PATCH v19 3/7] xbitmap: add more operations Thread-Topic: [PATCH v19 3/7] xbitmap: add more operations Thread-Index: AQHTc0KMPxidDJGIq0abfW8730V/4qNEPGkAgAGJ2oD//477AIABsteA///M64CAAJUboA== Date: Sun, 17 Dec 2017 11:50:03 +0000 Message-ID: <286AC319A985734F985F78AFA26841F739387B68@shsmsx102.ccr.corp.intel.com> References: <1513079759-14169-4-git-send-email-wei.w.wang@intel.com> <20171215184256.GA27160@bombadil.infradead.org> <5A34F193.5040700@intel.com> <201712162028.FEB87079.FOJFMQHVOSLtFO@I-love.SAKURA.ne.jp> <5A35FF89.8040500@intel.com> <201712171921.IBB30790.VOOOFMQHFSLFJt@I-love.SAKURA.ne.jp> In-Reply-To: <201712171921.IBB30790.VOOOFMQHFSLFJt@I-love.SAKURA.ne.jp> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOGUzOTY2NTMtZGYyZS00NTMyLThlYmEtYWM1OWQwMWE0ZTY5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IjBGS0tTcUFMR2VEU1p2RjlQaWsyakxWY25iWkF5anJPRFJxQWRZMHZzYUk9In0= x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Tetsuo Handa [mailto:penguin-kernel@I-love.SAKURA.ne.jp] > Sent: Sunday, December 17, 2017 6:22 PM > To: Wang, Wei W ; willy@infradead.org > Cc: 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; > david@redhat.com; cornelia.huck@de.ibm.com; > mgorman@techsingularity.net; aarcange@redhat.com; > amit.shah@redhat.com; pbonzini@redhat.com; > liliang.opensource@gmail.com; yang.zhang.wz@gmail.com; > quan.xu@aliyun.com; nilal@redhat.com; riel@redhat.com > Subject: Re: [PATCH v19 3/7] xbitmap: add more operations > > Wei Wang wrote: > > > But passing GFP_NOWAIT means that we can handle allocation failure. > > > There is no need to use preload approach when we can handle allocation > failure. > > > > I think the reason we need xb_preload is because radix tree insertion > > needs the memory being preallocated already (it couldn't suffer from > > memory failure during the process of inserting, probably because > > handling the failure there isn't easy, Matthew may know the backstory > > of > > this) > > According to https://lwn.net/Articles/175432/ , I think that preloading is > needed only when failure to insert an item into a radix tree is a significant > problem. > That is, when failure to insert an item into a radix tree is not a problem, I > think that we don't need to use preloading. It also mentions that the preload attempts to allocate sufficient memory to *guarantee* that the next radix tree insertion cannot fail. If we check radix_tree_node_alloc(), the comments there says "this assumes that the caller has performed appropriate preallocation". So, I think we would get a risk of triggering some issue without preload(). > > > > So, I think we can handle the memory failure with xb_preload, which > > stops going into the radix tree APIs, but shouldn't call radix tree > > APIs without the related memory preallocated. > > It seems to me that virtio-ballon case has no problem without using > preloading. Why is that? Best, Wei