Using a page is sufficient, and avoids the cost of vmalloc/vfree
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ulong nbytes)
{
int err;
- int bufsize = 65536;
+ int bufsize = PAGE_SIZE;
int written = 0;
u8 *buf;
- buf = vmalloc(bufsize);
+ buf = (u8 *) __get_free_page(GFP_KERNEL);
if (!buf)
return -ENOMEM;
memset(buf, ch, bufsize);
+
while (nbytes > 0) {
- ulong thisbytes = bufsize;
+ int thisbytes = bufsize;
if (nbytes < thisbytes)
thisbytes = nbytes;
err = 0;
cleanup:
- vfree(buf);
+ free_page((unsigned long) buf);
return err;
}
EXPORT_SYMBOL_GPL(visorchannel_clear);