From: Jens Axboe <jaxboe@fusionio.com>
To: Steven Lang <tirea@google.com>
Cc: fio@vger.kernel.org
Subject: Re: IO engine flags: FIO_RAWIO vs FIO_MEMALIGN
Date: Mon, 11 Jul 2011 08:32:53 +0200 [thread overview]
Message-ID: <4E1A9915.2030000@fusionio.com> (raw)
In-Reply-To: <CAAUT-yO47O=7fqVybxTzyra0RL0i_+q5vtyTj8KSd5RPvNZZ1Q@mail.gmail.com>
On 2011-07-02 03:11, Steven Lang wrote:
> Hello,
>
> What is the intended difference between these two flags? The former
> seems to carry some specific semantic meaning while the latter seems
> like it is merely a statement of requirement. However, within the
> code they seem to be used synonymously, to the point that if an IO
> engine uses FIO_RAWIO and not FIO_MEMALIGN it would potentially crash.
>
> From memory.c:196
> if (td->o.odirect || td->o.mem_align ||
> (td->io_ops->flags & FIO_MEMALIGN)) {
> total_mem += page_mask;
> if (td->o.mem_align && td->o.mem_align > page_size)
> total_mem += td->o.mem_align - page_size;
> }
>
> From fio.c:830
> if (td->o.odirect || td->o.mem_align ||
> (td->io_ops->flags & FIO_RAWIO))
> p = PAGE_ALIGN(td->orig_buffer) + td->o.mem_align;
>
> These two pieces of code seem like they are a pair that should always
> execute together, yet they have slightly different conditions. The
> result seems like if FIO_RAWIO is used without FIO_MEMALIGN, it will
> try to page align the buffer (Which of course involves just padding it
> to the next alignment) without the actual memory available to do so,
> resulting in the IO buffer overwriting other parts of the heap.
>
> If this is changed one way or the other, however, it would result in
> an unused flag. The condition in memory.c is the only place
> FIO_MEMALIGN appears, and FIO_RAWIO only makes two other
> appearances...
>
> From init.c:320
> if (o->bs_unaligned && (o->odirect || td->io_ops->flags & FIO_RAWIO))
> log_err("fio: bs_unaligned may not work with raw io\n");
> From init.c:585
> if (td->o.odirect)
> td->io_ops->flags |= FIO_RAWIO;
>
> The former doesn't actually do anything but print a message and run
> anyway (And should probably use the same form of the flag as the other
> two anyway), and the latter is redundant since the same check for
> FIO_RAWIO/FIO_MEMALIGN also checks for o.direct.
Sorry for missing this email. Yes, the two flags are a bit of a mix. I
think what used to be the case was that there used to be other
differences. But your analysis looks correct, FIO_RAWIO without MEMALIGN
would be buggy at this point.
Feel free to send a patch to unify and cleanup those flags.
--
Jens Axboe
prev parent reply other threads:[~2011-07-11 6:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-02 1:11 IO engine flags: FIO_RAWIO vs FIO_MEMALIGN Steven Lang
2011-07-11 6:32 ` Jens Axboe [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=4E1A9915.2030000@fusionio.com \
--to=jaxboe@fusionio.com \
--cc=fio@vger.kernel.org \
--cc=tirea@google.com \
/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.