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 5C119A0350; Thu, 25 Jun 2020 17:53:40 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0023E2B8B; Thu, 25 Jun 2020 17:53:38 +0200 (CEST) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by dpdk.org (Postfix) with ESMTP id 4F478E07 for ; Thu, 25 Jun 2020 17:53:37 +0200 (CEST) Received: by mail-wm1-f66.google.com with SMTP id o8so6067000wmh.4 for ; Thu, 25 Jun 2020 08:53:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=oGzHleBsxS56CTVrBbqh/U3Ckwi9yJNSV2N8Y1NQlTo=; b=BgaV2xtukMbfE9roswBGJQia6lbbu1c6DcTugLtGtStHGcCEAcMphQwG7fGgPs1oXz VWUtdrw1ZeKDrIf9tZNvMclb7FmNrs5AybyMTJx90Ohs9EoYcOTxaIoCXH/tuMbc9Vea 7WKRhAXduDMMiaiRSp8qOrW3O1JbPvi+FCk8hMOOqfbfRzQyP6JzjOuDe3W1Zr4vugMD c+ddUvrpBOj4GRScn+pNLDkQMisb8RGfnlv1bm5mC9kNd6zhgja3zfxVCRHG71fmnIPH ZKVMeZcya4aSc7Tysr0+1P3MTLBz+BtsllC8Tz7ePmNkRoHB+5EgyOqTKC7ERmg+cl/i EYdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=oGzHleBsxS56CTVrBbqh/U3Ckwi9yJNSV2N8Y1NQlTo=; b=GEvPSSpPfA2/PAV/DelmEE3IhogDEI9PKpBu6Lh90ShHsBMZAlUR8mRNzdik+guGeo VG1Z8DSu3pkqiNidjc4NEc0DIFncUX6JG2e6HbieBQrrJMChJtTkDFG9C2mOPzP0Vh76 51C/wK2MBx65dmcRJacx+j0CIAIw2NG0O5ITCuXMkjIu/FQN4Y5mMuBy5kiXQh+hMyVx Q5PVd6wMEmUDV7fs2ZxwSqbHOrDz3NJNA+sxdZ+QE8SryfUlK6mc3EchU94OIeftCt1n KvLNzAJ5BCygsFiSnrYlo2p3A5oNC1lFtewhBeCndPkoMNol5KHZTbXV2daEFuEnhuSw exKA== X-Gm-Message-State: AOAM532AEvWzTNL+7LVOFbPDZMBWPTfQ1cRYeEYhFr4QNOieVkOq7/fk UiAjlLpl5+gsdh25IGR54nQClg== X-Google-Smtp-Source: ABdhPJyCggN2KS2c8raO3F8N2A7ZwAA3+2wMNEDndN023lT99noJklCS+m2vFF71XCaxXBYmlyg8nQ== X-Received: by 2002:a1c:48d:: with SMTP id 135mr4202442wme.102.1593100417008; Thu, 25 Jun 2020 08:53:37 -0700 (PDT) Received: from 6wind.com (2a01cb0c0005a600345636f7e65ed1a0.ipv6.abo.wanadoo.fr. [2a01:cb0c:5:a600:3456:36f7:e65e:d1a0]) by smtp.gmail.com with ESMTPSA id g144sm15294200wme.2.2020.06.25.08.53.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jun 2020 08:53:36 -0700 (PDT) Date: Thu, 25 Jun 2020 17:53:36 +0200 From: Olivier Matz To: Xiaolong Ye Cc: Thomas Monjalon , Konstantin Ananyev , dev@dpdk.org, stable@dpdk.org Message-ID: <20200625155336.GR12564@platinum> References: <20200613154922.42379-1-xiaolong.ye@intel.com> <20200613154922.42379-4-xiaolong.ye@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200613154922.42379-4-xiaolong.ye@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [dpdk-dev] [PATCH 3/5] mbuf: fix free_space setting for dynamic field 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" On Sat, Jun 13, 2020 at 11:49:19PM +0800, Xiaolong Ye wrote: > The value free_space[i] is used to save the size of biggest aligned > element that can fit in the zone, current implementation has one flaw, > for example, if user registers dynfield1 (size = 4, align = 4, req = 124) > first, the free_space would be as below after registration: > > 0070: 08 08 08 08 08 08 08 08 > 0078: 08 08 08 08 00 00 00 00 > > Then if user continues to register dynfield2 (size = 4, align = 4), > free_space would become: > > 0070: 00 00 00 00 04 04 04 04 > 0078: 04 04 04 04 00 00 00 00 > > Further request dynfield3 (size = 8, align = 8) would fail to register > due to alignment requirement can't be satisfied, though there is enough > space remained in mbuf. > > This patch fixes above issue by saving alignment only in aligned zone, > after the fix, above registrations order can be satisfied, free_space > would be like: > > After dynfield1 registration: > > 0070: 08 08 08 08 08 08 08 08 > 0078: 04 04 04 04 00 00 00 00 > > After dynfield2 registration: > > 0070: 08 08 08 08 08 08 08 08 > 0078: 00 00 00 00 00 00 00 00 > > After dynfield3 registration: > > 0070: 00 00 00 00 00 00 00 00 > 0078: 00 00 00 00 00 00 00 00 > > This patch also reduces iterations in process_score() by jumping align > steps in each loop. > > Fixes: 4958ca3a443a ("mbuf: support dynamic fields and flags") > Cc: stable@dpdk.org > > Signed-off-by: Xiaolong Ye Acked-by: Olivier Matz Thanks!