From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by dpdk.org (Postfix) with ESMTP id 8A0832BAE for ; Thu, 25 Oct 2018 12:58:01 +0200 (CEST) Received: by mail-pl1-f181.google.com with SMTP id o19-v6so3660539pll.12 for ; Thu, 25 Oct 2018 03:58:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nADx23DQYeZdbJtr4F6Voj7vkaC52BT+dppzWLrLWJc=; b=CHd1ko1NOX3KaKKCf7Li9DXU31T2Z26l4Gs1zr27WKRzFvwjLIQ9xQIu3Vb9E3cVrP IT6XYfdErkHxFxFy1r8WTmD2WHz+6XMpBQ9U0/dj0rFVu7WWFHm4dRK7Nqs3OuQP271i 1FllgGVOuk3MRLQYQKVDS2B/CvVPHdFVTOOx4flDL/OxXaApZFIToXtBot4klSJQLjiI BT0wz6AQZfLesUM0tY0rZmbIM1AruvWp2zK72ZZP2oXalpNd0lrnHEtye/ZIkQ4OHlhR rAuJMZZLpGRCHWVJEvehfcwAUpYgQGXbogyzfuRwUXVKBTiu2mdqIw4Nh4szZ7zN8tt2 MgBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nADx23DQYeZdbJtr4F6Voj7vkaC52BT+dppzWLrLWJc=; b=Gv0aUatzmFvvkzhzTLahAwnTV8R/o6z4AoHsLafKC7Cm9QGkNBaQnqf3deyb05qe4K L0XKrOxinDGvRF4VJhHiI0EOBB3QH0Jv4VPNchJXmt7PropfTZs9LGIjGgn2KIZQAWj1 uzQwX2TihGHGxPlDLEeupUHcopwvZ1wncewvY5/IymLklkjrglIsWGoAowJoC+8FH0Gg 0bRCsAR0OZ5Kg/fBfPv3gmcLA+94lk6mwMuNlp+NlAxtNgRe2awP4aABDqzcB2uXLtWr upScS5tfQtahN1q2DPTqQ13xxLHMP6By069LnIsWsf6ljVDEnSyJuLCpojIXlLaZOgys chsg== X-Gm-Message-State: AGRZ1gIPXQdJZIYF9dLuZY60lqgunITfN361SocT3VHz8DhK8SAa2YAx if/3V/d0V+HXMnQbs257CwDvlopkDcQwk5bgzRg= X-Google-Smtp-Source: AJdET5f3LMRk8ooHPbeCgU6XszZfyrM6kGFCvJER6xYJKMLFsYdTZ3ug6pXp3XHt3XBHNv0j48AbFkxyNnzvKgEYlyo= X-Received: by 2002:a17:902:3a5:: with SMTP id d34-v6mr1018956pld.231.1540465080729; Thu, 25 Oct 2018 03:58:00 -0700 (PDT) MIME-Version: 1.0 References: <20c86454-227e-1f1e-fd76-84597f6c9154@intel.com> In-Reply-To: <20c86454-227e-1f1e-fd76-84597f6c9154@intel.com> From: Avinash Chaurasia Date: Thu, 25 Oct 2018 16:27:53 +0530 Message-ID: To: anatoly.burakov@intel.com Cc: dev@dpdk.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] Memory allocation in dpdk at basic level X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Oct 2018 10:58:01 -0000 Thanks a lot! Avinash Kumar Chaurasia On Tue, Oct 23, 2018 at 3:26 PM Burakov, Anatoly wrote: > On 22-Oct-18 10:08 PM, Avinash Chaurasia wrote: > > Hello, > > I am not sure whether this is right list for posting this problem. I am > > trying to understand how dpdk allocate memory. I tried digging code to > > understand memory allocation of DPDK. So far I understood that memory is > > allocated from a heap that dpdk maintains. However, this heap must be > > allocated at some place. I failed to traceback any function (called from > > heap_alloc()) that calls mmap to allocate memory. Please let me know when > > this heap is created, which function call does that. > > Thanks > > Avinash > > > > Hi Avinash, > > Here's a very high level overview. > > At initialization, we mmap() anonymous memory regions (eal_memory.c > contains the code - both for legacy and non-legacy mode). Then, we map > actual pages into that space either at init (in legacy mode) or as > needed (in non-legacy mode). > > In legacy mode, pages are mapped into anonymous memory straight away > (see legacy init code in eal_memory.c). For non-legacy, page allocation > happens in eal_memalloc.c on request from malloc (see malloc_heap.c). In > both cases, newly allocated pages are added to DPDK heap, and from there > they can be used by the rest of DPDK using rte_malloc or > rte_memzone_reserve API's. > > -- > Thanks, > Anatoly >