Search

CN-121996401-A - Nuclear selection method, electronic device, computer-readable storage medium, and program product

CN121996401ACN 121996401 ACN121996401 ACN 121996401ACN-121996401-A

Abstract

The application relates to the technical field of electronic equipment, and provides a nuclear selection method, electronic equipment, a computer readable storage medium and a program product, which are applied to the electronic equipment. The method comprises the steps that the electronic equipment determines a load threshold value used for selecting cores according to the frequency limiting values of the middle cores and the large cores, and then determines whether a target thread needing to be migrated to the large cores to run exists or not based on thread loads of candidate threads participating in the core selection and the determined load threshold value. Because the frequency limiting value is dynamically set based on the running states of the target application and the electronic equipment, the load threshold value determined based on the frequency limiting value can also dynamically change along with the running states of the target application and the electronic equipment, so that the adaptive load threshold value can be provided in various application scenes, and good performance and power consumption performance can be ensured in various application scenes by selecting cores for candidate threads based on the adaptive load threshold value.

Inventors

  • JIN WENQIANG

Assignees

  • 荣耀终端股份有限公司

Dates

Publication Date
20260508
Application Date
20241108

Claims (20)

  1. 1. The core selection method is characterized by being applied to electronic equipment, wherein the electronic equipment comprises a central processing unit, the core of the central processing unit comprises a middle core and a large core, and the method comprises the following steps: Starting a target application; obtaining frequency limiting values of the middle core and the large core, and determining a load threshold according to the frequency limiting values, wherein the frequency limiting values are dynamically set based on the running conditions of the target application and the electronic equipment; And under the condition that a target thread exists in candidate threads and the target thread runs in the middle core, migrating the target thread from the middle core to the big core, determining the target thread based on the load threshold and the thread load of the candidate thread, wherein the candidate thread is an application thread of the target application.
  2. 2. The method of claim 1, wherein the application threads comprise a rendering thread and at least one logical thread, the rendering thread being an application thread for out-frames in the target application, the logical thread being an application thread associated with out-frames and having a wakeup relationship with the rendering thread, the candidate threads comprising the rendering thread and a logical thread with a highest historical load.
  3. 3. The method of claim 1, wherein the application threads include a rendering thread and at least one logical thread, the rendering thread being an application thread for out-frames in the target application, the logical thread being an application thread having a wake-up relationship with the rendering thread and associated with out-frames; The method further comprises the steps of: The candidate thread is selected based on the transition core priority of the application thread, the candidate thread comprises two application threads with highest transition core priorities, the transition core priorities are set based on the historical load of the application threads, and the candidate thread is selected again based on the transition core priorities under the condition that the target thread does not exist in the selected candidate thread.
  4. 4. A method according to any one of claims 1-3, wherein the number of cores is smaller than the number of candidate threads, and only one of the candidate threads is run on one core.
  5. 5. The method of any of claims 1-4, wherein the obtaining the frequency limit values of the middle core and the large core comprises: And after the target application outputs frames for n times, acquiring frequency limiting values of the middle core and the large core, wherein n is a positive integer greater than or equal to 1, the thread load corresponding to the candidate thread is an average value of n single-frame thread loads, the n single-frame thread loads are thread loads corresponding to the n times of frame output one by one, and the single-frame thread loads are determined based on the running time of the candidate thread and the frequency of the core after the frame output.
  6. 6. The method according to any one of claims 1-5, further comprising: if the candidate thread runs on the big core, correcting the thread load corresponding to the candidate thread by using a correction coefficient; The correction coefficient is a ratio of a first load to a second load, the first load is a thread load when the candidate thread runs on the middle core, the second load is a thread load when the candidate thread runs on the big core, and the candidate thread corresponding to the first load and the candidate thread corresponding to the second load are the same.
  7. 7. The method of claim 6, wherein the method further comprises: Before the correction, if the candidate thread on the big core changes, updating the correction coefficient based on a first load and a second load corresponding to the changed candidate thread; And if the updated correction coefficient is smaller than a preset first coefficient threshold, taking the first coefficient threshold as the correction coefficient, and if the updated correction coefficient is larger than a second coefficient threshold, taking the second coefficient threshold as the correction coefficient, wherein the second coefficient threshold is larger than the first coefficient threshold.
  8. 8. The method according to any one of claims 1-7, further comprising: determining the load state of the candidate thread according to the load threshold value and the thread load of the candidate thread; if the load state is the first state, determining that the target thread does not exist in the candidate threads; And if the load state is a second state, determining that the target thread exists in the candidate threads, wherein the target thread is the candidate thread corresponding to the maximum thread load, and the load indicated by the second state is higher than the load indicated by the first state.
  9. 9. The method of claim 8, wherein the method further comprises: If the load state is a third state, judging whether the candidate thread corresponding to the largest thread load is migrated to the large core to run or not and whether the equipment power consumption gain exists, wherein the load indicated by the third state is higher than the load indicated by the first state and lower than the load indicated by the second state; Under the condition of equipment power consumption gain, taking a candidate thread corresponding to the maximum thread load as the target thread; in the absence of a device power consumption gain, determining that the target thread is absent from the candidate threads.
  10. 10. The method of claim 9, wherein the load threshold comprises a highest load threshold and a lowest load threshold, wherein the determining the load status of the candidate thread based on the load threshold and the thread load of the candidate thread comprises: determining the load state as the first state under the condition that the maximum value in the thread loads corresponding to the candidate threads is smaller than the lowest load threshold value; Determining the load state as the second state under the condition that the maximum value of the thread loads corresponding to the candidate threads is larger than the highest load threshold value; And determining the load state as the third state under the condition that the maximum value of the load of the threads corresponding to the candidate threads is larger than the lowest load threshold and smaller than the highest load threshold.
  11. 11. The method according to any one of claims 1-10, wherein the frequency limit value comprises a first highest frequency limit corresponding to the middle core, and the load threshold comprises a highest load threshold; The highest load threshold util1 is determined using the following expression: util1=smaf_M/fmax_M*ca_M*sa1; Wherein smaf _M is the first highest frequency limit, fmax_M is the maximum frequency of the middle core, ca_M is the maximum calculated force of the middle core, and sa1 is a preset constant.
  12. 12. The method of claim 11, wherein the frequency limit value further comprises a first minimum frequency corresponding to the middle core and a second minimum frequency corresponding to the large core; The lowest load threshold util2 is determined using the following expression: util2=max(smif_M/fmax_M*ca_M*sa2,smif_B/fmax_B*ca_B*sa2); wherein smif _M is the first minimum frequency, smif _B is the second minimum frequency, fmax_B is the maximum frequency of the large core, ca_B is the maximum calculated force of the large core, and sa2 is a preset constant.
  13. 13. The method of claim 9, wherein determining whether the candidate thread corresponding to the largest thread load migrates to a large core operation with a device power consumption gain comprises: calculating a load difference value, wherein the load difference value is a difference value between thread loads corresponding to the candidate threads; determining that the power consumption gain of the equipment exists under the condition that the absolute value of the load difference value is larger than a load difference threshold value; and determining the gain of the power consumption without equipment under the condition that the absolute value of the load difference value is smaller than the load difference threshold value, wherein the load difference threshold value is determined based on the maximum computing force of the middle core and the frequency point number.
  14. 14. The method of claim 13, wherein the load difference threshold is determined using the expression: util3=ca_M/nf_M*sa3; wherein, util3 is the load difference threshold, ca_M is the maximum calculation force of the middle core, nf_M is the frequency point number of the middle core, and sa3 is a preset coefficient.
  15. 15. The method of claim 9, wherein determining whether the candidate thread corresponding to the largest thread load migrates to a large core operation with a device power consumption gain comprises: determining first equipment power consumption and second equipment power consumption, wherein the first equipment power consumption is equipment power consumption before a candidate thread corresponding to the maximum thread load is migrated to a big core for operation, and the second equipment power consumption is equipment power consumption after the candidate thread corresponding to the maximum thread load is migrated to the big core for operation; if the power consumption of the first device is larger than that of the second device, determining that the power consumption gain of the device exists; and if the power consumption of the first equipment is smaller than or equal to the power consumption of the second equipment, determining the gain without equipment power consumption.
  16. 16. The method of claim 15, wherein the first device power consumption P1 is determined using the expression: P1=P_M(fb_M)*uMsum; The method comprises the steps of enabling fb_M to be a first core frequency before a candidate thread corresponding to the largest thread load is migrated to a large core to run, enabling P_M (fb_M) to be an energy efficiency value corresponding to the first core frequency, enabling uMsum to be a total load on the core before the candidate thread load is migrated to the large core to run, and enabling the energy efficiency value corresponding to the first core frequency to be determined based on the energy efficiency table.
  17. 17. The method according to claim 15 or 16, characterized in that the second device power consumption P2 is determined using the following expression: P2=P_M(fa_M)*(uMsum-uBsum)+P_B(freq_B)*uBsum; the method comprises the steps of determining a first kernel frequency, wherein fa_M is a second kernel frequency after a candidate thread corresponding to the largest thread load is migrated to a large kernel, freq_B is a large kernel frequency after the candidate thread corresponding to the largest thread load is migrated to the large kernel, P_M (fa_M) is an energy efficiency value corresponding to the second kernel frequency, P_B (freq_B) is an energy efficiency value corresponding to the large kernel frequency, uBsum is a total load on the large kernel after the candidate thread corresponding to the largest thread load is migrated to the large kernel, and the energy efficiency value corresponding to the second kernel frequency and the energy efficiency value corresponding to the large kernel frequency are determined based on the energy efficiency table.
  18. 18. The method of claim 17, wherein the first core frequency, the second core frequency, and the large core frequency are determined using the following expressions: fb_M or fa_m=x-ca_M fmax M X C; freq_B=Y/ca_B*fmax_B*C; The method comprises the steps of receiving a candidate thread corresponding to the thread load with the highest load from a large core after the candidate thread with the highest load is migrated to the large core, receiving the total load on the migrated large core, wherein X is the total load on the middle core with the highest load, Y is the total load on the large core after the candidate thread with the highest load is migrated to the large core, ca_M is the maximum calculated force of the middle core, ca_B is the maximum calculated force of the large core, fmax_M is the maximum frequency of the middle core, fmax_B is the maximum frequency of the large core, and C is a preset constant.
  19. 19. The method of any of claims 1-18, wherein the migrating the target thread from the middle core to the large core run comprises: Binding the target thread with the big core, or The method comprises the steps of setting a core selection priority for a target thread, selecting a core for the target thread based on the core selection priority, wherein the core selection priority of a big core is highest, migrating the target thread to the big core for operation based on the core selection priority when the big core is in normal operation, and migrating the target thread to the middle core for operation based on the core selection priority when the big core is in abnormal operation.
  20. 20. The method of claim 8, wherein the method further comprises: And if the candidate thread running on the big core exists under the condition that the target thread does not exist in the candidate threads, migrating the candidate thread running on the big core to the middle core for running.

Description

Nuclear selection method, electronic device, computer-readable storage medium, and program product Technical Field Embodiments of the present application relate to the field of electronic devices, and in particular, to a core selection method, an electronic device, a computer readable storage medium, and a program product. Background At present, most of central processors of electronic devices such as mobile phones, tablets, notebook computers and the like adopt a multi-core heterogeneous architecture, wherein the multi-core heterogeneous architecture comprises a plurality of cores, and the cores comprise small cores, medium cores and large cores. The performance and power consumption of the small core, the medium core, and the large core are all different. In order to balance application performance and electronic device power consumption, small cores, medium cores or large cores are conventionally scheduled for application threads through a core selection strategy. However, the performance difference of the traditional core selection strategy under different applications and chip platforms is relatively large, so that performance and power consumption performance under some application scenes are poor, universality is poor, and good performance and power consumption performance under all application scenes cannot be ensured. Disclosure of Invention The embodiment of the application provides a core selection method, electronic equipment, a computer readable storage medium and a program product, wherein the core selection method has high universality and can be suitable for various application scenes and chip platforms, so that good performance and power consumption performance under various application scenes can be ensured. In order to achieve the above purpose, the embodiment of the present application adopts the following technical scheme: In a first aspect, a method for selecting a core is provided, and the method is applied to an electronic device, wherein the electronic device comprises a central processing unit, and a core of the central processing unit comprises a middle core and a large core. The method comprises the steps of starting a target application, obtaining frequency limiting values of a middle core and a large core, determining a load threshold according to the frequency limiting values, wherein the frequency limiting values are dynamically set based on running conditions of the target application and electronic equipment, moving a target thread from the middle core to the large core to run under the condition that the target thread exists in candidate threads and runs in the middle core, determining the target thread based on the load threshold and the thread load of the candidate thread, and the candidate thread is an application thread of the target application. In this implementation, since the frequency limit value is dynamically set based on the operating states of the target application and the electronic device, the frequency limit value may dynamically change with the operating states of the target application and the electronic device. Then, the load threshold value determined based on the frequency limiting value also dynamically changes along with the running states of the target application and the electronic equipment, so that the adaptive load threshold value can be provided in various application scenes. And the decision to select the core is based on the adaptive load threshold, so that the situation that the application scenes and the chip platforms are not distinguished can be achieved, the load is dynamically distinguished, and good performance and power consumption performance under all application scenes can be ensured. That is, compared with the traditional mode of adopting a fixed load threshold, the implementation method can be applicable to various application scenes and chip platforms because the load threshold can be dynamically changed, has higher universality and can ensure good performance and power consumption performance under various application scenes. In one possible implementation manner of the first aspect, the application threads include a rendering thread and at least one logic thread, the rendering thread is an application thread for frame out in the target application, the logic thread is an application thread which has a wake-up relation with the rendering thread and is related to frame out, and the candidate threads include the rendering thread and a logic thread with the heaviest historical load. In this implementation, because the application threads that migrate to large core operations during actual operations are typically heavily loaded threads. The rendering threads for out-frames are typically the most heavily loaded application threads in the target application (e.g., gaming application). Therefore, the rendering thread is selected, and the logic thread which is related to the rendering thread and has the heaviest historical load is se