From: Michael Holzheu <holzheu@linux.vnet.ibm.com>
To: Dave Young <dyoung@redhat.com>
Cc: stefan.roscher@de.ibm.com, Simon Horman <horms@verge.net.au>,
kexec@lists.infradead.org
Subject: Re: [PATCH v2] kexec/s390x: use mmap instead of read for slurp_file()
Date: Wed, 28 Oct 2015 10:57:21 +0100 [thread overview]
Message-ID: <20151028105721.4ada142d@holzheu> (raw)
In-Reply-To: <20151028064623.GB30645@dhcp-128-73.nay.redhat.com>
On Wed, 28 Oct 2015 14:46:23 +0800
Dave Young <dyoung@redhat.com> wrote:
> Hi, Michael
>
> > @@ -552,11 +563,18 @@ char *slurp_file(const char *filename, o
> > if (err < 0)
> > die("Can not seek to the begin of file %s: %s\n",
> > filename, strerror(errno));
> > + buf = slurp_fd(fd, filename, size, &nread, use_mmap);
> > } else {
> > size = stats.st_size;
> > + if (use_mmap) {
> > + buf = mmap(NULL, size, PROT_READ | PROT_WRITE,
> > + MAP_PRIVATE, fd, 0);
> > + nread = stats.st_size;
> > + } else {
> > + buf = slurp_fd(fd, filename, size, &nread, 0);
> > + }
> > }
>
> Drop above changes and replace below lines with an extra use_mmap argument
> should be enough?
>
> - buf = slurp_fd(fd, filename, size, &nread);
> [snip]
Hmm, I don't think so.
In case of non-character devices I either mmap the file directly (use_mmap=true)
or use "slurp_fd()" (use_mmap=false). So I can't unconditionaly use slurp_fd().
The change in slurp_fd() to use anonymous mmap in case of use_mmap=true is
not really necessary. I did it nevertheless for consistency. This ensures
that the slrup_file_mmap() functions *always* returns mmaped memory.
Michael
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2015-10-28 9:57 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-23 3:10 [PATCH] Revert "kexec: use mmap instead of read for slurp_file()" Dave Young
2015-10-23 15:09 ` Michael Holzheu
2015-10-26 7:31 ` Dave Young
2015-10-27 12:35 ` [PATCH v2] kexec/s390x: use mmap instead of read for slurp_file() Michael Holzheu
2015-10-28 6:46 ` Dave Young
2015-10-28 9:57 ` Michael Holzheu [this message]
2015-10-29 6:37 ` Dave Young
2015-10-29 15:26 ` Michael Holzheu
2015-10-30 2:03 ` Dave Young
2015-10-30 10:13 ` Michael Holzheu
2015-10-30 13:39 ` Dave Young
2015-10-30 15:02 ` [PATCH v3] " Michael Holzheu
2015-11-09 1:59 ` Simon Horman
2015-10-26 4:30 ` [PATCH] Revert "kexec: use mmap instead of read for slurp_file()" Simon Horman
2015-11-03 0:11 ` Geoff Levand
2015-11-03 1:15 ` Dave Young
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=20151028105721.4ada142d@holzheu \
--to=holzheu@linux.vnet.ibm.com \
--cc=dyoung@redhat.com \
--cc=horms@verge.net.au \
--cc=kexec@lists.infradead.org \
--cc=stefan.roscher@de.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox