From owner-freebsd-current@freebsd.org Sat Jan 2 16:02:11 2021 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 067584D4F05 for ; Sat, 2 Jan 2021 16:02:11 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from ms-10.1blu.de (ms-10.1blu.de [178.254.4.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D7RVB15Y4z4Z59; Sat, 2 Jan 2021 16:02:09 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from [188.174.60.30] (helo=c720-r368166.unixarea.de) by ms-10.1blu.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kvjLz-0006Qz-Ti; Sat, 02 Jan 2021 17:02:08 +0100 Received: from c720-r368166.fritz.box (localhost [127.0.0.1]) by c720-r368166.unixarea.de (8.16.1/8.14.9) with ESMTPS id 102G26ZY044591 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 2 Jan 2021 17:02:06 +0100 (CET) (envelope-from guru@unixarea.de) Received: (from guru@localhost) by c720-r368166.fritz.box (8.16.1/8.14.9/Submit) id 102G26xu044590; Sat, 2 Jan 2021 17:02:06 +0100 (CET) (envelope-from guru@unixarea.de) X-Authentication-Warning: c720-r368166.fritz.box: guru set sender to guru@unixarea.de using -f Date: Sat, 2 Jan 2021 17:02:06 +0100 From: Matthias Apitz To: Alan Somers Cc: FreeBSD CURRENT Subject: Re: cp(1) of large files is causing 100% CPU utilization and poor transfer Message-ID: Reply-To: Matthias Apitz Mail-Followup-To: Alan Somers , FreeBSD CURRENT References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Operating-System: FreeBSD 13.0-CURRENT r368166 (amd64) X-message-flag: Mails containing HTML will not be read! Please send only plain text. X-Con-Id: 51246 X-Con-U: 0-guru X-Originating-IP: 188.174.60.30 X-Rspamd-Queue-Id: 4D7RVB15Y4z4Z59 X-Spamd-Bar: -- X-Spamd-Result: default: False [-2.20 / 15.00]; HAS_REPLYTO(0.00)[guru@unixarea.de]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_XOIP(0.00)[]; RWL_MAILSPIKE_GOOD(0.00)[178.254.4.101:from]; HAS_XAW(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWO(0.00)[2]; RECEIVED_SPAMHAUS_PBL(0.00)[188.174.60.30:received]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[178.254.4.101:from]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:42730, ipnet:178.254.0.0/19, country:DE]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[unixarea.de]; AUTH_NA(1.00)[]; SPAMHAUS_ZRD(0.00)[178.254.4.101:from:127.0.2.255]; RCVD_IN_DNSWL_LOW(-0.10)[178.254.4.101:from]; R_SPF_NA(0.00)[no SPF record]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-current] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jan 2021 16:02:11 -0000 El día sábado, enero 02, 2021 a las 08:42:01a. m. -0700, Alan Somers escribió: > > # dd if=guru-20210102.tar.gz of=/mnt/AcerC720/backups/guru-20210102.tar.gz > > bs=8m > > 4601+1 records in > > 4601+1 records out > > 38603862368 bytes transferred in 506.778929 secs (76174956 bytes/sec) > > # ls -lh guru-20210102.tar.gz > > -r-------- 1 root wheel 36G 2 ene. 12:19 guru-20210102.tar.gz > > > > When I use cp(1) what I normaly do the transfer is very poor and causes > > 100% CPU itilization: > > > > # cp -p guru-20210102.tar.gz /mnt/AcerC720/backups/xxx > > ^C > > > > killed after 1 minute; transfered in 1 minute: > > > > # ls -lh /mnt/AcerC720/backups/xxx > > -r-------- 1 root wheel 168M 2 ene. 15:34 /mnt/AcerC720/backups/xxx > > > > 168*1024*1024/60 = 2936012 bytes/sec ./. 76174956 bytes/sec > > > > Trussing the cp(1) process shows these sys calls: > > > > # truss -p 37655 > > copy_file_range(0x3,0x0,0x4,0x0,0x200000,0x0) = 2097152 (0x200000) > > copy_file_range(0x3,0x0,0x4,0x0,0x200000,0x0) = 2097152 (0x200000) > > copy_file_range(0x3,0x0,0x4,0x0,0x200000,0x0) = 2097152 (0x200000) > > copy_file_range(0x3,0x0,0x4,0x0,0x200000,0x0) = 2097152 (0x200000) > > copy_file_range(0x3,0x0,0x4,0x0,0x200000,0x0) = 2097152 (0x200000) > > > > The problem is unrelated to the external disk, also a copy > > in the local file system shows the same transfer speed of 168M per > > minute. > Not an issue I've heard of before. Could you please describe how your USB > and local disk are formatted? Also, where is the source file stored? It > could be that the source file's file system has a very slow implementation > of FIOSEEKDATA/FIOSEEKHOLE. > -Alan As I said, it can be reproduced using only the local file system. This was setup recently on a SSD: # dmesg | grep ada0 ada0 at ahcich0 bus 0 scbus0 target 0 lun 0 ada0: ACS-2 ATA SATA 3.x device ada0: Serial Number F995890846 ada0: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 1024bytes) ada0: Command Queueing enabled ada0: 488386MB (1000215216 512 byte sectors) and by this procedure: # gpart create -s gpt ada0 # gpart add -t freebsd-boot -s 512k -a4k -l ssdboot ada0 # gpart bootcode -b /boot/pmbr -p /boot/gptboot -i1 ada0 # gpart add -t freebsd-ufs -l ssdrootfs -b 1m -s 2g ada0 # gpart add -t freebsd-ufs -l ssdvarfs -a 1m -s 2g ada0 # gpart add -t freebsd-ufs -l ssdusrfs -a 1m ada0 # newfs -U -t /dev/gpt/ssdrootfs # newfs -U -t /dev/gpt/ssdvarfs # newfs -U -t /dev/gpt/ssdusrfs # gpart show -l ada0 => 40 1000215136 ada0 GPT (477G) 40 1024 1 ssdboot (512K) 1064 984 - free - (492K) 2048 4194304 2 ssdrootfs (2.0G) 4196352 4194304 3 ssdvarfs (2.0G) 8390656 16777216 4 ssdswap (8.0G) 25167872 975046656 5 ssdusrfs (465G) 1000214528 648 - free - (324K) # mount -t ufs /dev/gpt/ssdrootfs on / (ufs, local, soft-updates) /dev/gpt/ssdvarfs on /var (ufs, local, soft-updates) /dev/gpt/ssdusrfs on /usr (ufs, local, soft-updates) When I run in the /usr fs the command # cp -p guru-20210102.tar.gz xxx it copies around 168M per minute. matthias -- Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub ¡Con Cuba no te metas! «» Don't mess with Cuba! «» Leg Dich nicht mit Kuba an! http://www.cubadebate.cu/noticias/2020/12/25/en-video-con-cuba-no-te-metas/