All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Jan Stancek <jstancek@redhat.com>
Cc: LTP List <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v2] Rewrite process_vm_readv03.c test with new LTP API
Date: Wed, 9 Feb 2022 13:29:52 +0100	[thread overview]
Message-ID: <YgOzwASHXaQZtFII@rei> (raw)
In-Reply-To: <CAASaF6y3=gRaqxA8FnJ2DnA6sXhox7g1e40un6mvvrriDv2RvA@mail.gmail.com>

Hi!
> > > -static void gen_random_arr(int *arr, int arr_sz)
> > > +static void create_data_size(int *arr, int arr_sz, int buffsize)
> > >  {
> > >       long bufsz_left, bufsz_single;
> > >       int i;
> > >
> > > -     bufsz_left = bufsz;
> > > +     bufsz_left = buffsize;
> > >       for (i = 0; i < arr_sz - 1; i++) {
> > > -             bufsz_single = rand() % (bufsz_left / 2) + 1;
> > > +             bufsz_single = rand() % ((bufsz_left / 2) + 1);
> >
> > It was correct before you added the parenthesis, the + 1 was there to
> > make sure we do not end up with an empty buffer if rand() returned
> > multiple of bufsz_left/2.
> 
> I think that was to avoid the case you described below (modulo by zero),
> zero iov_len appears allowed, so it may be interesting to let it be tested too.
> (if bufsize and nriovecs allow such combination as you pointed out)

The iovec can work with zero len buffers just fine, I would add a
special handling for when the buffer is allocated though.

Also the changes of getting zero size buffer is very low unless we have
a case where the bufsize is close to nriovec. So I would really be for
adding a table with different combinations of bufsize, local_iovec,
remote_iovec and let the test loop over that.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      reply	other threads:[~2022-02-09 12:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27  9:49 [LTP] [PATCH v2] Rewrite process_vm_readv03.c test with new LTP API Andrea Cervesato
2022-02-09 10:30 ` Cyril Hrubis
2022-02-09 11:20   ` Jan Stancek
2022-02-09 12:29     ` Cyril Hrubis [this message]

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=YgOzwASHXaQZtFII@rei \
    --to=chrubis@suse.cz \
    --cc=jstancek@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.