Code Monkey home page Code Monkey logo

Comments (6)

lin755 avatar lin755 commented on August 24, 2024

In a multi-threaded single ctx scenarios,other threads enter spinlock,will waste a lot cpu time to busy waiting util the one thread release it.

from uadk.

lin755 avatar lin755 commented on August 24, 2024

If we did not bind all thread to one cpu ,the performance gap between spinlock and mutex is very small.
So how should we handle this balance of cpu usage and performance?

from uadk.

hzhuang1 avatar hzhuang1 commented on August 24, 2024

In a multi-threaded single ctx scenarios,other threads enter spinlock,will waste a lot cpu time to busy waiting util the one thread release it.

It wasted some cpu time, but it gained the performance.

from uadk.

hzhuang1 avatar hzhuang1 commented on August 24, 2024

If we did not bind all thread to one cpu ,the performance gap between spinlock and mutex is very small.
So how should we handle this balance of cpu usage and performance?

Frankly speaking, it's very complex. We downplay the impact on locks. Because of lock, it causes context switch, cache trashing, and so on. All of them could impact the performance. For this case, I can't give a precise answer on which one is improved most since it's hard to measure.

From my view, reducing cpu usage could impact performance. Let's use an example to discuss. If driver/app is polling hardware, it costs a lot of CPU time and gains the performance. If interrupt is used, it saves CPU time and loses the performance.

Up to now, I received the command to tune performance. It means that people are not satisfied on the performance. As my understanding, it's always a trade-off on CPU usage and performance in system. Now it seems that tuning performance is in higher priority.

from uadk.

lin755 avatar lin755 commented on August 24, 2024

I have read some dpdk and roce code,they barely use spinlock. When they use it,it had to be used, because the io interface is called in interrupts.
But if we agreed performance have a higher priority than CPU consumption, we should not use mutex in this send and receive process, and I also saw a huge promote from your patch.
At least, we can run all thread on different ctx to reduce lock competition.

from uadk.

lin755 avatar lin755 commented on August 24, 2024

Close this issue based on the above discussion.

from uadk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.