From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0A6B8A034E; Thu, 23 Apr 2020 17:42:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C53B71C240; Thu, 23 Apr 2020 17:42:30 +0200 (CEST) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by dpdk.org (Postfix) with ESMTP id 6A54E1C21E for ; Thu, 23 Apr 2020 17:42:28 +0200 (CEST) Received: by mail-pg1-f196.google.com with SMTP id n16so3067690pgb.7 for ; Thu, 23 Apr 2020 08:42:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smartx-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:content-transfer-encoding; bh=12I+cwfFnNOb1KIkMwmY2beU92vcKV0Z9nuc/sXv5DY=; b=TWVPQz4wWk5U0GHAx0C7JKokSEFM6m7Az6VDffAa7Qayj7SEI7VLYNr/swmFTvhztB NovDfFFz1NCar45VkWXsvbBh+BjHiTXT3mAnFC8LNX5wk8CsxymWw1+g5M9fas+1quD2 YGhjFZyUKmPEWXvp4STMQIOmWAGRHUAEvsCJvdz2rRmGSRuqmtX18BudwvSGzkbzguZZ D9YFwUAg6FA3I9SuqdgkpT+gd47dIlcA2n8ZW5VX8KrFkkXqBm/LP36HW93l2OMgN/os x2FblmJzYHeGdBPV5Y64WhdYtxlPDffaFl4UM9iIJokjt1exzC6TKxrNAErG9YX06YwY /HtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :in-reply-to:references:content-transfer-encoding; bh=12I+cwfFnNOb1KIkMwmY2beU92vcKV0Z9nuc/sXv5DY=; b=WzHJCW1zozFT33b62lEzEjp4bJJm2NHoGheICi0RzQfmNXchfq9udvf30EpZ80j8YX k+GW1NRVGw+dqr6B6CW0d3jW+7cIky/Zkwm56Asf3HobsV7dp/5aT7fVMx5xPlHKG1gc NfeuAzYAtw7xCKe4u/N8baPa7tEkbeni5qQNJurmjcVcWiD9Da+Q+n2xuU6Sc9JSTzhz Nwq/FF8etH1gpYHa0C+pyxSsAT7Ts53xs+TRWMzL2Bu1uYdJ/dk4s9Zwlo0W/yJ6Sm/w +l2cO3JiuofjQ9BWPJGvu/I3nmYFLFB4rdkpXxS3RopUqIOx+A4XLmkeXmUE1ALXAaCB I2vw== MIME-Version: 1.0 X-Gm-Message-State: AGi0PuaRBc5hWuoCqyKE5Ec4d0Qh5fUB+I4rS12Ng1oSDMDuDafH/+os lmKiKKOT/CJ0ld5LEqibPZmsMKsnWIT3lml6+vKDxEwN0qR35+MDuBBTolVw9fGTs/OCptMx X-Google-Smtp-Source: APiQypLdNm1Qz1pkc81u9CN+TI2I4b2sk4li/wvW4petpyAgPpwyt7BpUxaFqwmO/rs1vd6uurrFDQ== X-Received: by 2002:a63:5f4d:: with SMTP id t74mr4539775pgb.385.1587656547355; Thu, 23 Apr 2020 08:42:27 -0700 (PDT) Received: from 31_216.localdomain (nz132l98.bb27109.ctm.net. [27.109.132.98]) by smtp.gmail.com with ESMTPSA id gv7sm2640615pjb.16.2020.04.23.08.42.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Apr 2020 08:42:26 -0700 (PDT) From: Li Feng To: Anatoly Burakov Cc: dev@dpdk.org, kyle@smartx.com, lifeng1519@gmail.com, fanyang@smartx.com, Li Feng Date: Thu, 23 Apr 2020 23:43:01 +0800 Message-Id: <20200423154302.2217041-1-fengli@smartx.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200420070508.645533-1-fengli@smartx.com> References: <20200420070508.645533-1-fengli@smartx.com> Content-Type: text/plain; charset="GB2312" Content-Transfer-Encoding: quoted-printable Subject: [dpdk-dev] [PATCH v2] eal: add madvise to avoid dump memory 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Avoid dump all mapped memory to a core dump file when crash. Otherwise it will very large and it's hard to analyze with gdb. In my test, it will dump 128GiB memory to a core dump file when integrated to spdk with default configuration. Signed-off-by: Li Feng --- lib/librte_eal/common/eal_common_memory.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/librte_eal/common/eal_common_memory.c b/lib/librte_eal/com= mon/eal_common_memory.c index cc7d54e0c..2d9564b28 100644 --- a/lib/librte_eal/common/eal_common_memory.c +++ b/lib/librte_eal/common/eal_common_memory.c @@ -177,6 +177,20 @@ eal_get_virtual_area(void *requested_addr, size_t *siz= e, after_len =3D RTE_PTR_DIFF(map_end, aligned_end); if (after_len > 0) munmap(aligned_end, after_len); + + /* + * Exclude this pages from a core dump. + */ + if (madvise(aligned_addr, *size, MADV_DONTDUMP) !=3D 0) + RTE_LOG(WARNING, EAL, "Madvise with MADV_DONTDUMP failed: %s\n", + strerror(errno)); + } else { + /* + * Exclude this pages from a core dump. + */ + if (madvise(mapped_addr, map_sz, MADV_DONTDUMP) !=3D 0) + RTE_LOG(WARNING, EAL, "Madvise with MADV_DONTDUMP failed: %s\n", + strerror(errno)); } =20 return aligned_addr; --=20 2.11.0 --=20 The SmartX email address is only for business purpose. Any sent message=20 that is not related to the business is not authorized or permitted by=20 SmartX. =B1=BE=D3=CA=CF=E4=CE=AA=B1=B1=BE=A9=D6=BE=C1=E8=BA=A3=C4=C9=BF=C6=BC=BC=D3= =D0=CF=DE=B9=AB=CB=BE=A3=A8SmartX=A3=A9=B9=A4=D7=F7=D3=CA=CF=E4. =C8=E7=B1= =BE=D3=CA=CF=E4=B7=A2=B3=F6=B5=C4=D3=CA=BC=FE=D3=EB=B9=A4=D7=F7=CE=DE=B9=D8= ,=B8=C3=D3=CA=BC=FE=CE=B4=B5=C3=B5=BD=B1=BE=B9=AB=CB=BE=C8=CE=BA=CE=B5=C4= =C3=F7=CA=BE=BB=F2=C4=AC=CA=BE=B5=C4=CA=DA=C8=A8.