10 Nov, 2015
2 commits
-
Both VMX and SVM propagate virtual_tsc_khz in the same way, so this
patch removes the call-back set_tsc_khz() and replaces it with a common
function.Signed-off-by: Haozhong Zhang
Signed-off-by: Paolo Bonzini -
VMX and SVM calculate the TSC scaling ratio in a similar logic, so this
patch generalizes it to a common TSC scaling function.Signed-off-by: Haozhong Zhang
[Inline the multiplication and shift steps into mul_u64_u64_shr. Remove
BUG_ON. - Paolo]
Signed-off-by: Paolo Bonzini
11 Dec, 2013
1 commit
-
Introduce mul_u64_u32_shr() as proposed by Andy a while back; it
allows using 64x64->128 muls on 64bit archs and recent GCC
which defines __SIZEOF_INT128__ and __int128.(This new method will be used by the scheduler.)
Signed-off-by: Peter Zijlstra
Cc: fweisbec@gmail.com
Cc: Andy Lutomirski
Cc: Linus Torvalds
Link: http://lkml.kernel.org/n/tip-hxjoeuzmrcaumR0uZwjpe2pv@git.kernel.org
Signed-off-by: Ingo Molnar
23 Aug, 2013
1 commit
-
Commit f792685006274a850e6cc0ea9ade275ccdfc90bc ("math64: New
div64_u64_rem helper") implemented div64_u64 in terms of div64_u64_rem.
But div64_u64_rem was removed because it slowed down div64_u64 (and
there were no other users of div64_u64_rem).Device Mapper's I/O statistics support has a need for div64_u64_rem;
reintroduce this helper as a separate method that doesn't slow down
div64_u64, especially on 32-bit systems.Signed-off-by: Mike Snitzer
Cc: Stanislaw Gruszka
Cc: Ingo Molnar
Cc: Frederic Weisbecker
Cc: Mikulas Patocka
Signed-off-by: Alasdair G Kergon
13 Jun, 2013
1 commit
-
There is div64_long() to handle the s64/long division, but no mocro do
u64/ul division. It is necessary in some scenarios, so add this
function.[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Alex Shi
Cc: Ingo Molnar
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
01 May, 2013
1 commit
-
This reverts commit f792685006274a850e6cc0ea9ade275ccdfc90bc.
The cputime scaling code was changed/fixed and does not need the
div64_u64_rem() primitive anymore. It has no other users, so let's
remove them.Signed-off-by: Stanislaw Gruszka
Cc: Frederic Weisbecker
Cc: rostedt@goodmis.org
Cc: Linus Torvalds
Cc: Dave Hansen
Cc: Peter Zijlstra
Link: http://lkml.kernel.org/r/1367314507-9728-4-git-send-email-sgruszka@redhat.com
Signed-off-by: Ingo Molnar
14 Mar, 2013
1 commit
-
Provide an extended version of div64_u64() that
also returns the remainder of the division.We are going to need this to refine the cputime
scaling code.Signed-off-by: Frederic Weisbecker
Cc: Stanislaw Gruszka
Cc: Steven Rostedt
Cc: Peter Zijlstra
Cc: Ingo Molnar
Cc: Andrew Morton
16 Mar, 2012
1 commit
-
Add a div64_long macro which is used to devide a 64bit number by a long (which
can be 4 bytes on 32bit systems and 8 bytes on 64bit systems).Suggested-by: Thomas Gleixner
Signed-off-by: Sasha Levin
Cc: johnstul@us.ibm.com
Link: http://lkml.kernel.org/r/1331829374-31543-1-git-send-email-levinsasha928@gmail.com
Signed-off-by: Thomas Gleixner
27 Oct, 2010
1 commit
-
The current implementation of div64_u64 for 32bit systems returns an
approximately correct result when the divisor exceeds 32bits. Since doing
64bit division using 32bit hardware is a long since solved problem we just
use one of the existing proven methods.Additionally, add a div64_s64 function to correctly handle doing signed
64bit division.Addresses https://bugzilla.redhat.com/show_bug.cgi?id=616105
Signed-off-by: Brian Behlendorf
Signed-off-by: Oleg Nesterov
Cc: Ben Woodard
Cc: Jeremy Fitzhardinge
Cc: Mark Grondona
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
12 Jun, 2008
2 commits
-
iter_div_u64_rem is used in the x86-64 vdso, which cannot call other
kernel code. For this case, provide the always_inlined version,
__iter_div_u64_rem.Signed-off-by: Jeremy Fitzhardinge
Signed-off-by: Ingo Molnar -
We have a few instances of the open-coded iterative div/mod loop, used
when we don't expcet the dividend to be much bigger than the divisor.
Unfortunately modern gcc's have the tendency to strength "reduce" this
into a full mod operation, which isn't necessarily any faster, and
even if it were, doesn't exist if gcc implements it in libgcc.The workaround is to put a dummy asm statement in the loop to prevent
gcc from performing the transformation.This patch creates a single implementation of this loop, and uses it
to replace the open-coded versions I know about.Signed-off-by: Jeremy Fitzhardinge
Cc: Andrew Morton
Cc: john stultz
Cc: Segher Boessenkool
Cc: Christian Kujau
Cc: Robert Hancock
Signed-off-by: Ingo Molnar
01 May, 2008
2 commits
-
Rename div64_64 to div64_u64 to make it consistent with the other divide
functions, so it clearly includes the type of the divide. Move its definition
to math64.h as currently no architecture overrides the generic implementation.
They can still override it of course, but the duplicated declarations are
avoided.Signed-off-by: Roman Zippel
Cc: Avi Kivity
Cc: Russell King
Cc: Geert Uytterhoeven
Cc: Ralf Baechle
Cc: David Howells
Cc: Jeff Dike
Cc: Ingo Molnar
Cc: "David S. Miller"
Cc: Patrick McHardy
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
The current do_div doesn't explicitly say that it's unsigned and the signed
counterpart is missing, which is e.g. needed when dealing with time values.This introduces 64bit signed/unsigned divide functions which also attempts to
cleanup the somewhat awkward calling API, which often requires the use of
temporary variables for the dividend. To avoid the need for temporary
variables everywhere for the remainder, each divide variant also provides a
version which doesn't return the remainder.Each architecture can now provide optimized versions of these function,
otherwise generic fallback implementations will be used.As an example I provided an alternative for the current x86 divide, which
avoids the asm casts and using an union allows gcc to generate better code.
It also avoids the upper divde in a few more cases, where the result is known
(i.e. upper quotient is zero).Signed-off-by: Roman Zippel
Cc: john stultz
Cc: Thomas Gleixner
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds