Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
9794cf23
Commit
9794cf23
authored
Apr 06, 2016
by
Jan Lindström
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #168 from grooverdan/10.1-MDEV-8684-UT_RELAX_CPU_isnt_relaxing
MDEV-8684 ut relax cpu isnt relaxing
parents
04737330
26c38de8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
34 deletions
+54
-34
config.h.cmake
config.h.cmake
+1
-0
configure.cmake
configure.cmake
+11
-0
storage/innobase/include/ut0ut.h
storage/innobase/include/ut0ut.h
+15
-4
storage/innobase/ut/ut0ut.cc
storage/innobase/ut/ut0ut.cc
+5
-12
storage/xtradb/include/ut0ut.h
storage/xtradb/include/ut0ut.h
+17
-6
storage/xtradb/ut/ut0ut.cc
storage/xtradb/ut/ut0ut.cc
+5
-12
No files found.
config.h.cmake
View file @
9794cf23
...
...
@@ -225,6 +225,7 @@
#cmakedefine HAVE_PREAD 1
#cmakedefine HAVE_PAUSE_INSTRUCTION 1
#cmakedefine HAVE_FAKE_PAUSE_INSTRUCTION 1
#cmakedefine HAVE_HMT_PRIORITY_INSTRUCTION 1
#cmakedefine HAVE_RDTSCLL 1
#cmakedefine HAVE_READ_REAL_TIME 1
#cmakedefine HAVE_PTHREAD_ATTR_CREATE 1
...
...
configure.cmake
View file @
9794cf23
...
...
@@ -855,6 +855,17 @@ IF(NOT CMAKE_CROSSCOMPILING AND NOT MSVC)
}
"
HAVE_FAKE_PAUSE_INSTRUCTION
)
ENDIF
()
IF
(
NOT HAVE_PAUSE_INSTRUCTION
)
CHECK_C_SOURCE_COMPILES
(
"
#include <sys/platform/ppc.h>
int main()
{
__ppc_set_ppr_low();
__ppc_set_ppr_med();
return 0;
}
"
HAVE_HMT_PRIORITY_INSTRUCTION
)
ENDIF
()
ENDIF
()
CHECK_SYMBOL_EXISTS
(
tcgetattr
"termios.h"
HAVE_TCGETATTR 1
)
...
...
storage/innobase/include/ut0ut.h
View file @
9794cf23
...
...
@@ -88,15 +88,26 @@ struct ut_when_dtor {
the YieldProcessor macro defined in WinNT.h. It is a CPU architecture-
independent way by using YieldProcessor. */
# define UT_RELAX_CPU() YieldProcessor()
# elif defined(HAVE_ATOMIC_BUILTINS)
# elif defined(__powerpc__)
#include <sys/platform/ppc.h>
# define UT_RELAX_CPU() do { \
volatile lint volatile_var; \
os_compare_and_swap_lint(&volatile_var, 0, 1); \
volatile lint volatile_var = __ppc_get_timebase(); \
} while (0)
# else
# define UT_RELAX_CPU() ((void)0)
/* avoid warning for an empty statement */
# endif
#define UT_COMPILER_BARRIER() __asm__ __volatile__ ("":::"memory")
# if defined(HAVE_HMT_PRIORITY_INSTRUCTION)
#include <sys/platform/ppc.h>
# define UT_LOW_PRIORITY_CPU() __ppc_set_ppr_low()
# define UT_RESUME_PRIORITY_CPU() __ppc_set_ppr_med()
# else
# define UT_LOW_PRIORITY_CPU() ((void)0)
# define UT_RESUME_PRIORITY_CPU() ((void)0)
# endif
/*********************************************************************//**
Delays execution for at most max_wait_us microseconds or returns earlier
if cond becomes true.
...
...
@@ -342,7 +353,7 @@ Runs an idle loop on CPU. The argument gives the desired delay
in microseconds on 100 MHz Pentium + Visual C++.
@return dummy value */
UNIV_INTERN
ulint
void
ut_delay
(
/*=====*/
ulint
delay
);
/*!< in: delay in microseconds on 100 MHz Pentium */
...
...
storage/innobase/ut/ut0ut.cc
View file @
9794cf23
...
...
@@ -45,9 +45,6 @@ Created 5/11/1994 Heikki Tuuri
# include <string>
#endif
/* UNIV_HOTBACKUP */
/** A constant to prevent the compiler from optimizing ut_delay() away. */
UNIV_INTERN
ibool
ut_always_false
=
FALSE
;
#ifdef __WIN__
/*****************************************************************//**
NOTE: The Windows epoch starts from 1601/01/01 whereas the Unix
...
...
@@ -397,25 +394,21 @@ Runs an idle loop on CPU. The argument gives the desired delay
in microseconds on 100 MHz Pentium + Visual C++.
@return dummy value */
UNIV_INTERN
ulint
void
ut_delay
(
/*=====*/
ulint
delay
)
/*!< in: delay in microseconds on 100 MHz Pentium */
{
ulint
i
,
j
;
ulint
i
;
j
=
0
;
UT_LOW_PRIORITY_CPU
()
;
for
(
i
=
0
;
i
<
delay
*
50
;
i
++
)
{
j
+=
i
;
UT_RELAX_CPU
();
UT_COMPILER_BARRIER
();
}
if
(
ut_always_false
)
{
ut_always_false
=
(
ibool
)
j
;
}
return
(
j
);
UT_RESUME_PRIORITY_CPU
();
}
#endif
/* !UNIV_HOTBACKUP */
...
...
storage/xtradb/include/ut0ut.h
View file @
9794cf23
...
...
@@ -80,20 +80,31 @@ struct ut_when_dtor {
# elif defined(HAVE_FAKE_PAUSE_INSTRUCTION)
# define UT_RELAX_CPU() __asm__ __volatile__ ("rep; nop")
# elif defined(HAVE_ATOMIC_BUILTINS)
# define UT_RELAX_CPU() do { \
volatile lint volatile_var; \
os_compare_and_swap_lint(&volatile_var, 0, 1); \
} while (0)
# elif defined(HAVE_WINDOWS_ATOMICS)
/* In the Win32 API, the x86 PAUSE instruction is executed by calling
the YieldProcessor macro defined in WinNT.h. It is a CPU architecture-
independent way by using YieldProcessor. */
# define UT_RELAX_CPU() YieldProcessor()
# elif defined(__powerpc__)
#include <sys/platform/ppc.h>
# define UT_RELAX_CPU() do { \
volatile lint volatile_var = __ppc_get_timebase(); \
} while (0)
# else
# define UT_RELAX_CPU() ((void)0)
/* avoid warning for an empty statement */
# endif
#define UT_COMPILER_BARRIER() __asm__ __volatile__ ("":::"memory")
# if defined(HAVE_HMT_PRIORITY_INSTRUCTION)
#include <sys/platform/ppc.h>
# define UT_LOW_PRIORITY_CPU() __ppc_set_ppr_low()
# define UT_RESUME_PRIORITY_CPU() __ppc_set_ppr_med()
# else
# define UT_LOW_PRIORITY_CPU() ((void)0)
# define UT_RESUME_PRIORITY_CPU() ((void)0)
# endif
/*********************************************************************//**
Delays execution for at most max_wait_us microseconds or returns earlier
if cond becomes true.
...
...
@@ -334,7 +345,7 @@ Runs an idle loop on CPU. The argument gives the desired delay
in microseconds on 100 MHz Pentium + Visual C++.
@return dummy value */
UNIV_INTERN
ulint
void
ut_delay
(
/*=====*/
ulint
delay
);
/*!< in: delay in microseconds on 100 MHz Pentium */
...
...
storage/xtradb/ut/ut0ut.cc
View file @
9794cf23
...
...
@@ -46,9 +46,6 @@ Created 5/11/1994 Heikki Tuuri
# include <string>
#endif
/* UNIV_HOTBACKUP */
/** A constant to prevent the compiler from optimizing ut_delay() away. */
UNIV_INTERN
ibool
ut_always_false
=
FALSE
;
#ifdef __WIN__
/*****************************************************************//**
NOTE: The Windows epoch starts from 1601/01/01 whereas the Unix
...
...
@@ -398,25 +395,21 @@ Runs an idle loop on CPU. The argument gives the desired delay
in microseconds on 100 MHz Pentium + Visual C++.
@return dummy value */
UNIV_INTERN
ulint
void
ut_delay
(
/*=====*/
ulint
delay
)
/*!< in: delay in microseconds on 100 MHz Pentium */
{
ulint
i
,
j
;
ulint
i
;
j
=
0
;
UT_LOW_PRIORITY_CPU
()
;
for
(
i
=
0
;
i
<
delay
*
50
;
i
++
)
{
j
+=
i
;
UT_RELAX_CPU
();
UT_COMPILER_BARRIER
();
}
if
(
ut_always_false
)
{
ut_always_false
=
(
ibool
)
j
;
}
return
(
j
);
UT_RESUME_PRIORITY_CPU
();
}
#endif
/* !UNIV_HOTBACKUP */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment