From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4B0DFA0C47; Tue, 12 Oct 2021 17:37:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 00FE5411AC; Tue, 12 Oct 2021 17:37:19 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id 098D7411AB for ; Tue, 12 Oct 2021 17:37:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634053036; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UGsGyHY1OGxaymDHrTV95QiH9KoEvzMnYfmiA/XD62Y=; b=YoAzwvtahTRc6twtuKhEo8IDtWfFmNq72C8rIyp5uwkEnf0zmppMBNiTdOYSvL0nmb52lP oi2hgzw+WiDniuxtr1Qh+B/AQVGR2U1/nySqs+2f9BYXjv37a/8miyGOBChUH17VfyAjMb ER369VJEqA/IiKaWSPRcSCMzcAipNQU= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-507-n1B5nBUpPqCprnKQQj1M3w-1; Tue, 12 Oct 2021 11:37:14 -0400 X-MC-Unique: n1B5nBUpPqCprnKQQj1M3w-1 Received: by mail-lf1-f70.google.com with SMTP id bi16-20020a0565120e9000b003fd56ef5a94so14347824lfb.3 for ; Tue, 12 Oct 2021 08:37:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UGsGyHY1OGxaymDHrTV95QiH9KoEvzMnYfmiA/XD62Y=; b=UU3SIUYubRwZH0Bs//VJMdvFmVNu9RakWSQCEX6BeojzGSLYGXSsP5ZBKUe0KaT3g6 QZCeBNqKuf4uyTKZxXYM0t4EetVtDKCaM9HrWNUPvrRPv+higB0wYG9Leiwm9sJCWAeM Sr2zdaIFl1W7Ho0ArhoMKaaOt256iCqVWwHoIPdj3hVnaAJ1RQ5MuoHL/d3oo4r8zc0A Z+IoeZuNbmrK65py4h1DrscF6Pc99MD/o/msM0wwm7WU4FS2jzAoGB7bX9/aysyGD3DD XvkU9hqaiIJ2cyaOCyE/w05bnONX14JzqRFL7ZJLxZyEBUQn6e4W9i/ldLz3fAcRsiBH reaQ== X-Gm-Message-State: AOAM531wkUx/LGLB7wOI4tQD+TI5IGYrBuURCrc0eiotzg+AF7pRUVf3 jBvpatZbDW98VgckBbprj67pXsOYS8SzoMwpRp/984INv13QDYKtkFgKy4DZzmAdKGJ67Ub26Z+ rqgx4cmjDi2lgOIxEz0s= X-Received: by 2002:a2e:8e34:: with SMTP id r20mr27944714ljk.333.1634053032790; Tue, 12 Oct 2021 08:37:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhHwFqzqCoR5r0IZMZZNa9VjQVyEWYu5H2xEw2uTE9xhhQDqVlUfLB/wmlaBdkEIW7kfw6V/4SLq/kJPp7Wyc= X-Received: by 2002:a2e:8e34:: with SMTP id r20mr27944691ljk.333.1634053032583; Tue, 12 Oct 2021 08:37:12 -0700 (PDT) MIME-Version: 1.0 References: <20210921081632.858873-1-dkozlyuk@nvidia.com> <20211011085644.2716490-1-dkozlyuk@nvidia.com> <20211011085644.2716490-3-dkozlyuk@nvidia.com> In-Reply-To: <20211011085644.2716490-3-dkozlyuk@nvidia.com> From: David Marchand Date: Tue, 12 Oct 2021 17:37:01 +0200 Message-ID: To: Dmitry Kozlyuk Cc: dev , Viacheslav Ovsiienko , Anatoly Burakov Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v6 2/3] eal: add memory pre-allocation from existing files X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hello Dmitry, Slava, On Mon, Oct 11, 2021 at 10:57 AM Dmitry Kozlyuk wrote: > > From: Viacheslav Ovsiienko > > The primary DPDK process launch might take a long time if initially > allocated memory is large. From practice allocation of 1 TB of memory > over 1 GB hugepages on Linux takes tens of seconds. Fast restart > is highly desired for some applications and launch delay presents > a problem. > > The primary delay happens in this call trace: > rte_eal_init() > rte_eal_memory_init() > rte_eal_hugepage_init() > eal_dynmem_hugepage_init() > eal_memalloc_alloc_seg_bulk() > alloc_seg() > mmap() > > The largest part of the time spent in mmap() is filling the memory > with zeros. Kernel does so to prevent data leakage from a process > that was last using the page. However, in a controlled environment > it may not be the issue, while performance is. (Linux-specific > MAP_UNINITIALIZED flag allows mapping without clearing, but it is > disabled in all popular distributions for the reason above.) > > It is proposed to add a new EAL option: --mem-file FILE1,FILE2,... > to map hugepages "as is" from specified FILEs in hugetlbfs. > Compared to using external memory for the task, EAL option requires > no change to application code, while allowing administrator > to control hugepage sizes and their NUMA affinity. > > Limitations of the feature: > > * Linux-specific (only Linux maps hugepages from files). > * Incompatible with --legacy-mem (partially replaces it). > * Incompatible with --single-file-segments > (--mem-file FILEs can contain as many segments as needed). > * Incompatible with --in-memory (logically). > > A warning about possible security implications is printed > when --mem-file is used. > > Until this patch DPDK allocator always cleared memory on freeing, > so that it did not have to do that on allocation, while new memory > was cleared by the kernel. When --mem-file is in use, DPDK clears memory > after allocation in rte_zmalloc() and does not clean it on freeing. > Effectively user trades fast startup for occasional allocation slowdown > whenever it is absolutely necessary. When memory is recycled, it is > cleared again, which is suboptimal par se, but saves complication > of memory management. I have some trouble figuring the need for the list of files. Why not use a global knob --mem-clear-on-alloc for this behavior change? > > Signed-off-by: Viacheslav Ovsiienko > Signed-off-by: Dmitry Kozlyuk -- David Marchand