作者
digoal
日期
2022-04-08
标签
PostgreSQL , arm , arm64 , 多核 , 性能 , spin
ARM多核适配 性能提升 - Use ISB as a spin-delay instruction on ARM64
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=a82a5eee314df52f3183cedc0ecbcac7369243b1
Use ISB as a spin-delay instruction on ARM64.
author Tom Lane <tgl@sss.pgh.pa.us>
Wed, 6 Apr 2022 22:57:57 +0000 (18:57 -0400)
committer Tom Lane <tgl@sss.pgh.pa.us>
Wed, 6 Apr 2022 22:58:14 +0000 (18:58 -0400)
commit a82a5eee314df52f3183cedc0ecbcac7369243b1
tree 66b56e90a4483c68930a083534fc1963859464a7 tree
parent 8ea7963fc741b6f403a544d56ad0ecf78e5237b1 commit | diff
Use ISB as a spin-delay instruction on ARM64.
This seems beneficial on high-core-count machines, and not harmful
on lesser hardware. However, older ARM32 gear doesn't have this
instruction, so restrict the patch to ARM64.
Geoffrey Blake
Discussion: https://postgr.es/m/78338F29-9D7F-4DC8-BD71-E9674CE71425@amazon.com
src/include/storage/s_lock.h
+/*
+ * Using an ISB instruction to delay in spinlock loops appears beneficial on
+ * high-core-count ARM64 processors. It seems mostly a wash for smaller gear,
+ * and ISB doesn't exist at all on pre-v7 ARM chips.
+ */
+#if defined(__aarch64__) || defined(__aarch64)
+
+#define SPIN_DELAY() spin_delay()
+
+static __inline__ void
+spin_delay(void)
+{
+ __asm__ __volatile__(
+ " isb; \n");
+}
+
+#endif /* __aarch64__ || __aarch64 */
期望 PostgreSQL 增加什么功能?
PolarDB for PostgreSQL云原生分布式开源数据库
PostgreSQL 解决方案集合
德哥 / digoal's github - 公益是一辈子的事.

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




