Why can the kernel not use SSE/AVX registers and instructions?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












This post from StackOverflow has this,




In some environments there there is a restriction on certain instructions or using certain registers. For example, in the Linux kernel, use of SSE/AVX or FP registers is generally disallowed. Therefore most of the optimized memcpy variants cannot be used as they rely on SSE or AVX registers, and a plain 64-bit mov-based copy is used on x86. For these platforms, using rep movsb allows most of the performance of an optimized memcpy without breaking the restriction on SIMD code.




Why is that, that the x86_64 Kernel can not use SSE/AVX? If it would make memcopy() faster it seems like it should be allowed. I'm just learning Intel Assembly, and specifically looking to learn SEE/AVX when I saw this comment.



Specifically interested in SSE/MME and AVX optimizations in the Linux Kernel.










share|improve this question





















  • One reason some OSes restrict the use of certain registers is that if they are used, then they must be saved on a context switch, which means that context switches take longer and thread contexts grow larger. I don't know whether this the/a reason why Linux puts restrictions on SIMD registers.
    – Gilles
    8 mins ago










  • I'm in two minds about this question. It's off-topic here since it's about programming: a user or system administrator wouldn't care at all. Its rightful place is Stack Overflow. But I know that Stack Overflow has an epidermic reaction against “why”, even though this is a perfectly legitimate, answerable question that's on-topic on Stack Overflow. And Unix & Linux probably has enough expertise to answer it, even though it's on the outer side of the topic border.
    – Gilles
    4 mins ago














up vote
0
down vote

favorite












This post from StackOverflow has this,




In some environments there there is a restriction on certain instructions or using certain registers. For example, in the Linux kernel, use of SSE/AVX or FP registers is generally disallowed. Therefore most of the optimized memcpy variants cannot be used as they rely on SSE or AVX registers, and a plain 64-bit mov-based copy is used on x86. For these platforms, using rep movsb allows most of the performance of an optimized memcpy without breaking the restriction on SIMD code.




Why is that, that the x86_64 Kernel can not use SSE/AVX? If it would make memcopy() faster it seems like it should be allowed. I'm just learning Intel Assembly, and specifically looking to learn SEE/AVX when I saw this comment.



Specifically interested in SSE/MME and AVX optimizations in the Linux Kernel.










share|improve this question





















  • One reason some OSes restrict the use of certain registers is that if they are used, then they must be saved on a context switch, which means that context switches take longer and thread contexts grow larger. I don't know whether this the/a reason why Linux puts restrictions on SIMD registers.
    – Gilles
    8 mins ago










  • I'm in two minds about this question. It's off-topic here since it's about programming: a user or system administrator wouldn't care at all. Its rightful place is Stack Overflow. But I know that Stack Overflow has an epidermic reaction against “why”, even though this is a perfectly legitimate, answerable question that's on-topic on Stack Overflow. And Unix & Linux probably has enough expertise to answer it, even though it's on the outer side of the topic border.
    – Gilles
    4 mins ago












up vote
0
down vote

favorite









up vote
0
down vote

favorite











This post from StackOverflow has this,




In some environments there there is a restriction on certain instructions or using certain registers. For example, in the Linux kernel, use of SSE/AVX or FP registers is generally disallowed. Therefore most of the optimized memcpy variants cannot be used as they rely on SSE or AVX registers, and a plain 64-bit mov-based copy is used on x86. For these platforms, using rep movsb allows most of the performance of an optimized memcpy without breaking the restriction on SIMD code.




Why is that, that the x86_64 Kernel can not use SSE/AVX? If it would make memcopy() faster it seems like it should be allowed. I'm just learning Intel Assembly, and specifically looking to learn SEE/AVX when I saw this comment.



Specifically interested in SSE/MME and AVX optimizations in the Linux Kernel.










share|improve this question













This post from StackOverflow has this,




In some environments there there is a restriction on certain instructions or using certain registers. For example, in the Linux kernel, use of SSE/AVX or FP registers is generally disallowed. Therefore most of the optimized memcpy variants cannot be used as they rely on SSE or AVX registers, and a plain 64-bit mov-based copy is used on x86. For these platforms, using rep movsb allows most of the performance of an optimized memcpy without breaking the restriction on SIMD code.




Why is that, that the x86_64 Kernel can not use SSE/AVX? If it would make memcopy() faster it seems like it should be allowed. I'm just learning Intel Assembly, and specifically looking to learn SEE/AVX when I saw this comment.



Specifically interested in SSE/MME and AVX optimizations in the Linux Kernel.







kernel intel assembly optimization syscalls






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 11 mins ago









Evan Carroll

4,73693875




4,73693875











  • One reason some OSes restrict the use of certain registers is that if they are used, then they must be saved on a context switch, which means that context switches take longer and thread contexts grow larger. I don't know whether this the/a reason why Linux puts restrictions on SIMD registers.
    – Gilles
    8 mins ago










  • I'm in two minds about this question. It's off-topic here since it's about programming: a user or system administrator wouldn't care at all. Its rightful place is Stack Overflow. But I know that Stack Overflow has an epidermic reaction against “why”, even though this is a perfectly legitimate, answerable question that's on-topic on Stack Overflow. And Unix & Linux probably has enough expertise to answer it, even though it's on the outer side of the topic border.
    – Gilles
    4 mins ago
















  • One reason some OSes restrict the use of certain registers is that if they are used, then they must be saved on a context switch, which means that context switches take longer and thread contexts grow larger. I don't know whether this the/a reason why Linux puts restrictions on SIMD registers.
    – Gilles
    8 mins ago










  • I'm in two minds about this question. It's off-topic here since it's about programming: a user or system administrator wouldn't care at all. Its rightful place is Stack Overflow. But I know that Stack Overflow has an epidermic reaction against “why”, even though this is a perfectly legitimate, answerable question that's on-topic on Stack Overflow. And Unix & Linux probably has enough expertise to answer it, even though it's on the outer side of the topic border.
    – Gilles
    4 mins ago















One reason some OSes restrict the use of certain registers is that if they are used, then they must be saved on a context switch, which means that context switches take longer and thread contexts grow larger. I don't know whether this the/a reason why Linux puts restrictions on SIMD registers.
– Gilles
8 mins ago




One reason some OSes restrict the use of certain registers is that if they are used, then they must be saved on a context switch, which means that context switches take longer and thread contexts grow larger. I don't know whether this the/a reason why Linux puts restrictions on SIMD registers.
– Gilles
8 mins ago












I'm in two minds about this question. It's off-topic here since it's about programming: a user or system administrator wouldn't care at all. Its rightful place is Stack Overflow. But I know that Stack Overflow has an epidermic reaction against “why”, even though this is a perfectly legitimate, answerable question that's on-topic on Stack Overflow. And Unix & Linux probably has enough expertise to answer it, even though it's on the outer side of the topic border.
– Gilles
4 mins ago




I'm in two minds about this question. It's off-topic here since it's about programming: a user or system administrator wouldn't care at all. Its rightful place is Stack Overflow. But I know that Stack Overflow has an epidermic reaction against “why”, even though this is a perfectly legitimate, answerable question that's on-topic on Stack Overflow. And Unix & Linux probably has enough expertise to answer it, even though it's on the outer side of the topic border.
– Gilles
4 mins ago















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475956%2fwhy-can-the-kernel-not-use-sse-avx-registers-and-instructions%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475956%2fwhy-can-the-kernel-not-use-sse-avx-registers-and-instructions%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay