Skip to content

Commit

Permalink
net/xdp: use shift instead of 64 bit division
Browse files Browse the repository at this point in the history
64bit division is kind of expensive, and shift should do the job here.

Signed-off-by: Pavel Machek (CIP) <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
pavelmachek authored and davem330 committed Jun 4, 2020
1 parent a624a86 commit 7d877c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/xdp/xdp_umem.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
if ((addr + size) < addr)
return -EINVAL;

npgs = div_u64(size, PAGE_SIZE);
npgs = size >> PAGE_SHIFT;
if (npgs > U32_MAX)
return -EINVAL;

Expand Down

0 comments on commit 7d877c3

Please sign in to comment.