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 v2] syscalls/pipe12: add new test for pipe when write bytes > PIPE_BUF
Date: Thu, 23 Jan 2020 13:47:11 +0100	[thread overview]
Message-ID: <20200123124711.GF27845@rei> (raw)
In-Reply-To: <90d369da-1340-d919-e9e5-f819d028daf9@cn.fujitsu.com>

Hi!
> > 		Here as well, write is supposed to return the number of
> > 		bytes written so in this case the TST_RET must be
> > 		max_size - tcase->offset which is all we have to check
> > 		for, anything else than that means failure.
> I have seen pipe_write kernel code[1], it only merged small size write 
> but not large size write(large size write will still page-align size, in 
> other word, it uses new page). So, I think it is why man-pages said 
> "from 1 to n bytes may be written". It may exist a hole when we use a 
> unalign offset and the sequent align-page write. I think it is normal 
> and don't need to mean failure.  "TST_RET is max_size - tcase->offset" 
> is ok when we use [0,N*page_size-1] [page_size,page_buf-1] write or 
> [0,a-1] [a, page_buf-1] write.
> 
> The other reason for it I guess beacause looking for a hole  may drop 
> peformance when pipe buf is large.
> 
> Also, we can print write btyes by ioctl(fd, FIONREAD, &nbytes) command
> (cover this ioctl test point).

Okay, I see that we merge only if the write fits into the free space in
the current head in the right buffer. Which means that we may write less
than max pipe size if we do not write in page aligned chunks.

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2020-01-23 12:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1577269768-30118-1-git-send-mail-xuyang2018.jy@cn.fujitsu.com>
2020-01-07  2:53 ` [LTP] [PATCH v2] syscalls/pipe12: add new test for pipe when write bytes > PIPE_BUF Yang Xu
2020-01-10 13:37   ` Cyril Hrubis
2020-01-13  7:38     ` Yang Xu
2020-01-23 12:47       ` Cyril Hrubis [this message]
2020-01-14  8:40     ` [LTP] [PATCH v3] syscalls/pipe12: add new test for pipe when write bytes > pipe size Yang Xu

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=20200123124711.GF27845@rei \
    --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