From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jay Rolette Subject: Re: [PATCH] Avoid possible memory cpoy when sort hugepages Date: Wed, 10 Dec 2014 15:36:37 -0600 Message-ID: References: <1418178341-4193-1-git-send-email-michael.qiu@intel.com> <20141210104110.GB10056@bricha3-MOBL3> <533710CFB86FA344BFBF2D6802E60286C9E768@SHSMSX101.ccr.corp.intel.com> <2601191342CEEE43887BDE71AB977258213BEA97@IRSMSX105.ger.corp.intel.com> <2601191342CEEE43887BDE71AB977258213BED0C@IRSMSX105.ger.corp.intel.com> <2601191342CEEE43887BDE71AB977258213BED20@IRSMSX105.ger.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Cc: "dev-VfR2kkLFssw@public.gmane.org" To: "Ananyev, Konstantin" Return-path: In-Reply-To: <2601191342CEEE43887BDE71AB977258213BED20-kPTMFJFq+rEu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" On Wed, Dec 10, 2014 at 12:39 PM, Ananyev, Konstantin < konstantin.ananyev-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote: > > I just got through replacing that entire function in my repo with a call > to qsort() from the standard library last night myself. Faster > > (although probably not material to most deployments) and less code. > > If you feel like it is worth it, why not to submit a patch? :) On Haswell and IvyBridge Xeons, with 128 1G huge pages, it doesn't make a user-noticeable difference in the time required for rte_eal_hugepage_init(). The reason I went ahead and checked it in my repo is because: a) it eats at my soul to see an O(n^2) case for something where qsort() is trivial to use b) we will increase that up to ~232 1G huge pages soon. Likely doesn't matter at that point either, but since it was already written... What *does* chew up a lot of time in init is where the huge pages are being explicitly zeroed in map_all_hugepages(). Removing that memset() makes find_numasocket() blow up, but I was able to do a quick test where I only memset 1 byte on each page. That cut init time by 30% (~20 seconds in my test). Significant, but since I'm not entirely sure it is safe, I'm not making that change right now. On Linux, shared memory that isn't file-backed is automatically zeroed before the app gets it. However, I haven't had a chance to chase down whether that applies to huge pages or not, much less how hugetlbfs factors into the equation. Back to the question about the patch, if you guys are interested in it, I'll have to figure out your patch submission process. Shouldn't be a huge deal other than the fact that we are on DPDK 1.6 (r2). Cheers, Jay