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 B23D3A0093; Wed, 31 Aug 2022 18:42:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 57B7440F17; Wed, 31 Aug 2022 18:42:22 +0200 (CEST) Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by mails.dpdk.org (Postfix) with ESMTP id D58C840F17 for ; Wed, 31 Aug 2022 18:42:21 +0200 (CEST) Received: by mail-pj1-f46.google.com with SMTP id fa2so6979027pjb.2 for ; Wed, 31 Aug 2022 09:42:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc; bh=YoMmWa637ibUWbH9QM7mc6K7OlHcVKEqfT1zvY+VRe4=; b=0GJo+l4TsUfI6Wcs8H5KJU9NliGtswf8/F/dPsNeQqw901ClqIgH/uQbac7UvWCrd1 qyEJEuezp+hdAR/NMk2NqVnlwNYp9dkIDyrt7JKlosbZLoVpWtIArag6CNW8wr/5gZhD seAdOIQhaU9ZfvhQOqoO/efmguzJWcwgQP3+PiL39Lqd0/kT6ukt61z1H94UtdxdCx/F pxEwYeIp0RYsr8ccCJfDuC5NwM4gJ8Ea3aDA7BmlKs11cLlbAO2XCjUsphKqGZHmR44h 2mO6/J2olLnPdPRP0/RjltHIb/X8OIdFH2DE1m0oTFaEjO9VXETY8zwb6SukZMgn4xHO Q5Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=YoMmWa637ibUWbH9QM7mc6K7OlHcVKEqfT1zvY+VRe4=; b=w+NaANUSsN88NLoAGvg3nZ5W06Sj+ogKMmB7RCPqh6/Fd+cURkMZFrrMze0MoOdCZf Y/41ZArO7kEKUUAFGJVKWPcsdmw8ZdjFCG2vJG1N/HXhP17Lb+M44VWq4aABUoJjNm5b ROXCyswAGjex6iWOnM2XfA++oG6iLsADu+xrL/obZVEbJlYwgy2/uGrl1MzI9vY9YhIw i7ER1XwaIkVnyZy3ujMvOAk7el+E9PPuIn5Sq8M4cBrJhQ2gx5yzd/2rharGwPB2MDki Iaqlsn9XMyp0DX51zIbIpexStnc0VrV/V9TVMbpEaImsjEaci7LZKNt8mj/YnPydtypQ sbJQ== X-Gm-Message-State: ACgBeo0k6wrkgd4ybKogBb6a6rNAqnAGfH73J7sPID3WCwTF6SAafsp0 jdm0d8Wz7qByp58PfXWFosemQQ== X-Google-Smtp-Source: AA6agR6pLTTU310S3nqtgzaUEiElT11gCpfvqyS1uQGxNSgImfljeQezDWfRomv8VxI/iCRIKB1u2g== X-Received: by 2002:a17:90b:4b89:b0:1f5:68b:b14e with SMTP id lr9-20020a17090b4b8900b001f5068bb14emr4286572pjb.30.1661964140807; Wed, 31 Aug 2022 09:42:20 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id 199-20020a6300d0000000b00419ab8f8d2csm3550212pga.20.2022.08.31.09.42.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Aug 2022 09:42:20 -0700 (PDT) Date: Wed, 31 Aug 2022 09:42:19 -0700 From: Stephen Hemminger To: "Zhou, YidingX" Cc: Ferruh Yigit , "dev@dpdk.org" , "Zhang, Qi Z" , "stable@dpdk.org" Subject: Re: [PATCH] net/pcap: reduce time for stopping device Message-ID: <20220831094219.74f5aa6c@hermes.local> In-Reply-To: References: <20220825072041.10768-1-yidingx.zhou@intel.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 Mon, 29 Aug 2022 11:50:29 +0000 "Zhou, YidingX" wrote: > I draw a diagram to describe it more clearly > > fwrite fclose/fflush fclose/fdatasync > --------->| libc buffer |----------------> | disk cache in RAM |---------------------> |disk| > | 4096 Bytes | | size is determined by OS | | | > > When the libc buffer is full, the system will automatically sync it to the disk cache. > It is easily full as it's only 4096 B size. so there is no need to call 'fflush()' every time. > The real time consuming action is syncing the disk cache to disk. > Because the disk cache is very large, it will take a long time to sync all at one time during 'fclose()', > so need to call 'fdatasync()' periodically to amortize the time. If you want to speed up this, then get rid of stdio and use a faster API like io_uring. What you tried can help but using a better API would make bigger gains.