public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3 1/2] splice02: Generate input in C
Date: Fri, 16 Apr 2021 14:32:40 +0200	[thread overview]
Message-ID: <YHmD6Efvn/f6Eh+G@yuki> (raw)
In-Reply-To: <YHhNQSCotEieKcnx@pevik>

Hi!
> > LGTM, going to merge it with these changes (+ cleanup to_write)
> > and your Reviewed-by: tags.
> > Thanks a lot!
> 
> Maybe one more change: INT_MAX is a bit too much, it timeouts.
> I'll use 262144 as max allowed -n (the default on intel - 2x max pipe size).

I guess that the main problem here is that we write one character at a
time, which means that we spend most of the time in syscall handler code
rather than copying the data. It may work much better if we change the
code to write 512 bytes at a time. I.e. something as:

	#define BUFSIZE 512

	char buf[BUFSIZE];

	memset(buf, 'a', BUFSIZE);

	while (to_write > 0) {
		size_t size = to_write > BUFSIZE ? BUFSIZE : to_write;

		...

		to_write -= written;
	}

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2021-04-16 12:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-13  4:38 [LTP] [PATCH v3 1/2] splice02: Generate input in C Petr Vorel
2021-04-13  4:38 ` [LTP] [PATCH v3 2/2] commands: Add shell pipe test Petr Vorel
2021-04-15 13:46 ` [LTP] [PATCH v3 1/2] splice02: Generate input in C Cyril Hrubis
2021-04-15 14:11   ` Petr Vorel
2021-04-15 14:27     ` Petr Vorel
2021-04-16 12:32       ` Cyril Hrubis [this message]
2021-04-16 13:10         ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YHmD6Efvn/f6Eh+G@yuki \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox