vhost: fix mmap not aligned with hugepage size
authorJianfeng Tan <jianfeng.tan@intel.com>
Thu, 12 Nov 2015 06:06:01 +0000 (14:06 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Tue, 24 Nov 2015 20:34:11 +0000 (21:34 +0100)
commitec09c280b83975b6444cb87eaf12fee970fde70f
tree45980105114406c09999a514ccfc37e498cd689f
parente1f8f5557147fbc9e1e8b9098c93ed9cc08e42e2
vhost: fix mmap not aligned with hugepage size

This patch fixes a bug under lower version linux kernel, mmap()
fails when length is not aligned with hugepage size. mmap()
without flag of MAP_ANONYMOUS, should be called with length
argument aligned with hugepagesz at older longterm version
Linux, like 2.6.32 and 3.2.72, or mmap() will fail with EINVAL.
This bug was fixed in Linux kernel by commit:
dab2d3dc45ae7343216635d981d43637e1cb7d45
To avoid failure, make sure in caller to keep length aligned.

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Huawei Xie <huawei.xie@intel.com>
lib/librte_vhost/vhost_user/virtio-net-user.c