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 7C5CF42527; Wed, 6 Sep 2023 17:08:24 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 19C914027C; Wed, 6 Sep 2023 17:08:24 +0200 (CEST) Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by mails.dpdk.org (Postfix) with ESMTP id A7E4140270 for ; Wed, 6 Sep 2023 17:08:22 +0200 (CEST) Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-56c2e882416so2326152a12.3 for ; Wed, 06 Sep 2023 08:08:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1694012901; x=1694617701; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=9jyu/d9zy4bmQnex6UZxzqkFdzjDsaNsT8OEC9cXoa8=; b=ItZf/Tdw4UJHh2jXsS9N6uEO+70HclYAyRZ4Gn8ap7wOLPPCZ1DH84IfBBpS9FtH8n GbI0VwPmG/yolALmh3DdqiVvERUh6i/2YGywxfPik+I6+wzxkWe8mdWjEa+LHQljPbuH 7qeqptDuCk5ESWGnUz5AWedmZTDEaU67l0fnKbEP+bHe1VnWWMH20mLSOjkqraUXWlSL rXsFUA1KzhC8++NCM7vrMQrRyTvIHZQT2GmaMKV9PxE3mEy0/zvP5GXYjmxiQqhnTE6G E0ImWPTiVpdzF9VnU8sqSH8T+uSXypXf9MMxeWlZdPIuxv7lR9Xn/BMwLcwnfNQXD3f2 rirg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694012901; x=1694617701; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9jyu/d9zy4bmQnex6UZxzqkFdzjDsaNsT8OEC9cXoa8=; b=h3Ht2oH7Tg0bdH62uIcL5j9iqZhpQkzmvlH6uERpghfpW8HWwEjpW15P7+zPERdfQc EnG3jorAM9M/M3O5xIiWdeIX5EiXOPnLHntAb4qSP7csOh9LzJcztgal6irgH0ZQSr/E y+4v3EYcmbpRx9W7LCts3bZQxZXgPUW5Wckd8UXSdwDBfnYBI/+5RHXZ3Y3FYy1cq5Kr 4wGbOwTIIQF3zGk374RWg57rp4RpWS/07l04WpOe7kp4VmWcZ0pXnP2NMlN1iScWW4QK Ayox4TVpbadN+qmGi7Bc0bFw+dNZZd0bNM/rD+IJ22cH9SZ5QYzpJhwR3tK3gt+rJJhy oD4g== X-Gm-Message-State: AOJu0YwrfdF4LyFduPo5sifraJpeYn7pzOr/qfWXMXXfaxky01k7LGVi eao9cDYxCp0q5IP0KcNenUm4fg== X-Google-Smtp-Source: AGHT+IEKX3m8fVro5tAHmeA1aZLYF7yIVLdYeu+re8l3TjOvdIIcH1GfmNCSEmVHvwHHTHjHXk8rvg== X-Received: by 2002:a17:90b:395:b0:263:3386:9da8 with SMTP id ga21-20020a17090b039500b0026333869da8mr12019333pjb.49.1694012901605; Wed, 06 Sep 2023 08:08:21 -0700 (PDT) Received: from hermes.local (204-195-112-131.wavecable.com. [204.195.112.131]) by smtp.gmail.com with ESMTPSA id bh10-20020a170902a98a00b001bb3beb2bc6sm11090032plb.65.2023.09.06.08.08.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Sep 2023 08:08:21 -0700 (PDT) Date: Wed, 6 Sep 2023 08:08:19 -0700 From: Stephen Hemminger To: Fengnan Chang Cc: anatoly.burakov@intel.com, dev@dpdk.org, dkozlyuk@nvidia.com Subject: Re: [RFC PATCH] move memset out of hold lock when rte_free Message-ID: <20230906080819.689bcb8d@hermes.local> In-Reply-To: <20230831111937.60975-1-changfengnan@bytedance.com> References: <20230831111937.60975-1-changfengnan@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 On Thu, 31 Aug 2023 19:19:37 +0800 Fengnan Chang wrote: > +#ifndef RTE_MALLOC_DEBUG > + if (internal_conf->legacy_mem) { > + /* If orig_elem is dirty, the joint element is clean, we need do memset now */ > + if (elem->orig_elem->dirty && !elem->dirty) > + memset(ptr, 0, data_len); > + } else if (!elem->dirty) { > + memset(ptr, 0, data_len); > + } > +#else > + /* Always poison the memory in debug mode. */ > + memset(ptr, MALLOC_POISON, data_len); > +#endif The code reads better if positive clause was first. I.e. #ifdef RTE_MALLOC_DEBUG /* Always poison the memory in debug mode. */ memset(ptr, MALLOC_POISON, data_len); #else ...