Task and data management method and device
By managing the tasks and data management methods executed by nodes in the NUMA architecture, obtaining memory access information and determining ownership relationships, and optimizing tasks and data distribution, the problem of low access efficiency of tasks and data in the NUMA architecture is solved, and the system performance is improved.
Patent Information
- Application Number
- CN202311376170.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-23
- Publication Date
- 2025-04-25
AI Technical Summary
Under the NUMA architecture, the proportion of remote access to tasks and data has increased, resulting in a reduction in end-to-end efficiency of tasks, and it is difficult for the existing technology to effectively optimize active data migration.
Through the management methods of the tasks and data execution by the management nodes, the access information of the access instructions in multiple nodes is obtained, the ownership relationship between thread tasks and data segments is determined, and the tuning object and its association domain are determined based on the access information and ownership relationship, and the scheduling decisions and migration strategies are formulated to optimize the distribution of tasks and data.
Adaptive task and data distribution tuning are realized, reducing remote access and improving overall system performance.
Smart Images

Figure CN119883582A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a task and data management method and device. Background Art
[0002] With the continuous influx of a series of parallel computing scenarios such as relational database systems, the demand for concurrent operation processing capabilities of the system has increased significantly. Figure 1 As shown in Figure 1, all processors evenly share all memory through the system bus. When the number of processors increases, the competition for the system bus will become a bottleneck. The non-uniform memory access (NUMA) architecture can simultaneously meet the characteristics of easy development of the SMP architecture and easy expansion of parallel systems, so it has become one of the mainstream architectures of current servers.
[0003] NUMA architecture (such as Figure 2 Generally, there are multiple nodes, each of which can have multiple CPUs, and the nodes share the same memory management unit (MMU). Therefore, each node is equivalent to an SMP architecture system, and the node memory is balanced for all CPUs in the node. At the same time, the NUMA architecture allows the CPU to access its non-local nodes, which can usually be divided into neighbor nodes and remote nodes. The access speed is negatively correlated with the distance between the CPU and the accessed memory. Pure remote access can have a performance gap of 30%+ compared to completely local node access.
[0004] Because the CPU has global memory access rights under the NUMA architecture, some tasks / data may be allocated to remote nodes during runtime. Such scenarios include: task migration caused by the scheduler, memory allocation during zswap memory decompression, and loading of associated pages during page fault swapping. These scenarios may increase the proportion of remote access to tasks, thereby affecting the end-to-end efficiency of tasks. The single task binding operation reduces remote access by limiting task migration, but it cannot optimize the problem scenario of active data migration and may cause resource congestion of individual CPUs. Summary of the invention
[0005] The embodiments of the present application provide a method and device for managing tasks and data, which adaptively and proactively optimize the distribution of tasks and data to improve system performance.
[0006] In a first aspect, the present application provides a task and data management method, which is applied to a computer system, wherein the computer system includes multiple nodes, and the multiple nodes include a management node. The task and data management method provided by the present application is executed by the management node, and the task and data management method provided by the present application includes: obtaining memory access information of memory access instructions in each of the multiple nodes; determining the ownership relationship between thread tasks and data segments, the ownership relationship indicating the data segments owned by each thread task in each of the multiple nodes, and the thread tasks to which each data segment in each of the multiple nodes belongs; based on the memory access information of the memory access instructions, determining a tuning object, the tuning object including The method includes a target thread task or a target data segment, and the target thread task or the target data segment has a degraded access situation; based on the ownership relationship between the thread task and the data segment, determining the target association domain corresponding to the tuning object, the target association domain includes the tuning object, and the thread tasks and data segments related to the tuning object; determining the scheduling decision of each thread task in the association domain and the migration decision of each data segment; sending the scheduling decision of each thread task to the first node where the thread task is located, so that the first node schedules the thread task based on the received scheduling decision, and sending the migration strategy of each data segment to the second node where the data segment is located, so that the second node migrates the data segment based on the received migration strategy.
[0007] The task and data management method provided in the present application provides a set of adaptive automatic tuning or management mechanisms, which senses the state of the system by acquiring the memory access information of the memory access instructions in each of multiple nodes. When it is sensed that the state of the system is not good, for example, under the distribution of the current thread tasks / data segments, there are thread tasks / data segments with degraded access conditions (such as remote access), the thread tasks / data segments with degraded access are actively tuned to reduce remote access and improve the overall performance of the system.
[0008] For the convenience of description below, thread tasks are referred to as threads.
[0009] In a possible implementation, a specific implementation of obtaining memory access information of memory access instructions in each of the multiple nodes is: receiving sampling data sent by a hardware sampler deployed on each of the multiple nodes, the sampling data including the memory access information of the memory access instructions.
[0010] That is to say, the present application collects memory access information of memory access instructions in each of multiple nodes through hardware sampling method. Hardware sampling is independent of system load, user operations and management decisions, and is updated with low overhead at runtime to achieve user-imperceptible memory access feature perception.
[0011] In another possible implementation, when the sampling data collected by the hardware sampler reaches a preset size, the hardware sampler sends the collected sampling data to the management node. That is, the hardware sampler on each node transmits the sampling information to the management node in units of a certain size buffer, for example, in units of 4096 bytes of memory space. When the sampling data collected by the hardware sampler occupies a memory space of 4096 bytes, the sampling data is sent to the management node. This avoids the loss of real-time performance due to excessive sampling data, and also avoids excessive computing costs due to frequent calculations of small sampling data.
[0012] Optionally, the hardware sampler is a statistical profiling extension (SPE) or a processor event sampler (PEBS).
[0013] In another possible implementation, the memory access information of the memory access instruction includes the execution time of the memory access instruction, the memory access address, and the thread to which the memory access instruction belongs; a specific implementation of determining the ownership relationship between the thread and the data segment is: based on the execution time of the memory access instruction, the memory access address, and the thread to which the memory access instruction belongs, determine the ownership relationship between the current thread and the data segment.
[0014] In this possible implementation, the ownership relationship between the thread and the data segment is determined by the memory access information of the memory access instruction collected by SPE / PEBS hardware sampling. For example, the memory access information of the memory access instruction includes the memory access address, such as the virtual address (VA) and / or the physical address (PA), and the thread identifier (such as the thread number). The thread number and the VA are recorded as having an ownership relationship. SPE / PEBS hardware sampling can collect the ownership relationship between all threads and data segments that actually exist in the system, ensuring the globality of the ownership relationship between threads and data segments.
[0015] In another possible implementation, a specific implementation of determining the ownership relationship between the current thread and the data segment based on the execution time of the memory access instruction, the memory access address, and the thread to which the memory access instruction belongs is: based on the execution time of the memory access instruction, the memory access address, and the thread to which the memory access instruction belongs, determining a number of data pages that each current thread task has ownership of; and aggregating the several data pages to determine the data segment that each thread task has ownership of.
[0016] The granularity of data accessed by memory access instructions is page granularity. Multiple discrete data pages corresponding to one thread are aggregated to obtain continuous data segments, thereby achieving batch migration during data migration.
[0017] In another possible implementation, a number of data pages are aggregated to determine a data segment that each thread has ownership of. A specific implementation is: obtain a number of valid data pages from a number of data pages that each thread has ownership of, and a valid data page is a data page with an access frequency greater than a first preset threshold; aggregate the valid data pages whose virtual address distance is less than a second preset threshold in the number of valid data pages to obtain the data segment that each thread has ownership of. In other words, a certain access heat threshold is set, and data with an access heat greater than or equal to the heat threshold (for example, an access frequency greater than or equal to 5) is used as a valid access data page to avoid the situation where the entire segment of data is aggregated, and adjacent data pages are aggregated to obtain the data segment that the thread has ownership of. Adjacent data pages can be defined by judging whether the distance between two data pages is less than a second preset threshold. For example, the second preset threshold can be 32 bits, and the distance between the virtual addresses of two data pages is less than 32 bits. It is called an adjacent data page. It can be understood that the second preset threshold can be a default value, or it can be defined as a user-set value, allowing the user to control the granularity of aggregation by setting the value of the second preset threshold.
[0018] In another possible implementation, the ownership relationship between the thread and the data segment is determined based on ownership relationship marking information, where the ownership relationship marking information marks the data segment that each thread in each node among multiple nodes has ownership; the ownership relationship marking information is obtained based on data application operations of each thread task captured at runtime; or, the ownership relationship marking information is obtained based on information input by a user.
[0019] By capturing and marking the ownership relationship between threads and data segments at runtime, and / or by allowing users to input the ownership relationship between threads and data segments, the ownership relationship between threads and data segments is more accurate.
[0020] In one example, the ownership relationship between a thread and a data segment is determined and recorded in a mapping table in a bidirectional index structure; the mapping table includes a thread index and a data index, the thread index is used to find a data segment owned by a thread task through a thread, and the data index is used to find a thread task to which a data segment belongs through a data segment. Compared with the related task-data management structure, the mapping relationship is a one-way mapping from task to data. There is a lack of a corresponding structure for locating a certain data to the thread to which it belongs. It is necessary to locate the thread through a trigger method similar to AutoNUMA (triggering an interrupt when data is accessed and marking the visitor). The trigger time is uncertain, and a large amount of interrupt costs are incurred to form a global portrait. This application greatly reduces the cost of locating data to threads by constructing and maintaining a bidirectional mapping relationship between thread-data and data-thread.
[0021] In another possible implementation, the mapping table further records one or more of the node where each thread is located, the node where the data segment is located, and the access frequency of the data segment to which each thread has ownership.
[0022] In another possible implementation, the memory access information of the memory access instruction also includes one or more of the CPU running node corresponding to the memory access instruction, the memory access delay, and the memory access read / write type; a specific implementation of determining the tuning object based on the memory access information of the memory access instruction is: based on the ownership relationship between the thread and the data segment and the memory access information of the memory access instruction, determining the data profile between each thread and the data segment to which it owns, the data profile describes the memory access characteristics of each thread for the data segment to which it owns; based on the data profile, determining the tuning object.
[0023] Optionally, the memory access feature includes one or more of a historical memory access pattern, a memory access ratio within a node or between nodes, a memory access heat, and a memory access delay.
[0024] In another possible implementation, the task and data management method provided by the present application also includes displaying data portraits for the convenience of users or tuning experts to view, and further analysis can be performed through the data portraits to supplement some thread scheduling decisions or data migration decisions.
[0025] In an example, the degraded access condition includes one or more of remote access, access delay greater than a third preset threshold, and bandwidth occupancy greater than a fourth preset threshold.
[0026] Remote access or access with a delay greater than a third preset threshold or a bandwidth occupancy greater than a fourth preset threshold may be defined as a degraded access. For example, if a thread's access to data is analyzed and determined to be a remote access, the thread's access to the data is determined to be a degraded access, and the thread or data needs to be scheduled or migrated. For another example, if a thread's access delay to data is greater than the third preset threshold, the thread's access to the data is determined to be a degraded access. For another example, if a thread's access bandwidth occupancy to data is greater than the fourth preset threshold, the thread's access to the data is determined to be a degraded access.
[0027] The need means that the third preset threshold and the fourth preset threshold can be default values or user settings. For example, if the user defines the third threshold as 10ms, when it is detected that the access delay of a thread to data is greater than 10ms, the thread's access to data is judged to be degraded access; for another example, if the user defines the fourth preset threshold as 300M / s, the thread's access to data is judged to be degraded access. Of course, the user can set the third preset threshold and the fourth preset threshold according to actual conditions to control the definition standard of degraded access.
[0028] In another possible implementation, based on the ownership relationship between the thread and the data segment, a target association domain corresponding to the tuning object is determined. A specific implementation is: a thread or a data segment that has an ownership relationship with the tuning object is determined as a first association object; a thread or a data segment that has an ownership relationship with the first object is determined as a second association object; after several calculation iterations, N association objects are obtained, where N is a positive integer; based on the tuning object and the N association objects, the target association domain corresponding to the tuning object is determined.
[0029] In this possible implementation, starting from the tuning object (that is, the thread / data segment that needs to be tuned), based on the ownership relationship of the bidirectional index, the associated domain corresponding to the tuning object is quickly iterated and calculated, and the threads / data segments in the associated domain are tuned to avoid ping-pong migration and waste of migration costs.
[0030] In another possible implementation, determination of the associated object is also related to a propagation threshold. When the access frequency between a thread or a data segment and an object in a target associated domain is greater than or equal to the propagation threshold, the thread task or the data segment is determined as an associated object.
[0031] Optionally, the number of calculation iterations is a preset number.
[0032] In another possible implementation, a specific implementation of determining the scheduling decision of each thread and the migration decision of each data segment in the association domain is: calculating the scores of multiple scheduling decisions for each thread in the association domain, multiple scheduling strategies indicate that each thread is scheduled from the current node to other associated nodes, the associated node is the node where the thread or data segment in the target association domain is located, and the score of the scheduling decision is used to evaluate the access performance of each thread to the data segment to which it has ownership relationship after the scheduling decision is executed; the scheduling decision with the highest score among the multiple scheduling decisions is used as the scheduling decision for each thread in the association domain; calculating the scores of multiple migration decisions for each data segment in the association domain, multiple migration strategies indicate that each data segment is migrated from the current node to other associated nodes, and the score of the migration decision is used to evaluate the access performance of each data segment by the thread to which it belongs after the migration decision is executed; and the migration decision with the highest score among the multiple migration decisions is used as the migration decision for each data segment in the association domain.
[0033] In one example, the score of the scheduling decision is determined based on the access delay optimization amount and the scheduling cost after the thread is scheduled; the score of the migration decision is determined based on the access delay optimization amount and the migration cost after the data segment is migrated.
[0034] In another possible implementation, the task and data management method provided by the present application also includes: determining whether the scheduling decisions of each thread and the migration decisions of each data segment meet the executable conditions; and discarding the scheduling decisions and migration decisions that do not meet the executable conditions.
[0035] In another possible implementation, the executable conditions include one or more of the following: the memory space of the target node corresponding to the scheduling decisions of each thread and the migration decisions of each data segment is met, and the bandwidth between the current node and the target node corresponding to the scheduling decisions of each thread and the migration decisions of each data segment is met.
[0036] In another possible implementation, the scheduling decision of each thread is sent to the first node where each thread is located so that the first node schedules the thread based on the received scheduling decision. A specific implementation is: sending the scheduling decision of each thread as prompt information to the thread scheduler in the first node where each thread is located, the prompt information is used as the thread scheduler to determine the influencing factors of the thread scheduling policy, and the thread scheduler is used to schedule the thread according to the thread scheduling policy; sending the migration strategy of each data segment to the second node where each data segment is located so that the second node migrates the data segment based on the received migration strategy. A specific implementation is: sending the migration strategy of each data segment to the data migration queue in the second node where each data segment is located, so that the second node executes the migration instruction in the data migration queue to migrate each data segment from the current node to the target node.
[0037] Optionally, the architecture of the computer system mentioned above is a NUMA architecture, and the multiple nodes are multiple NUMA nodes; or the computer system includes multiple Hosts, and the multiple nodes are multiple Host nodes.
[0038] In a second aspect, the present application provides a task and data management device, which is applied to a computer system. The computer system includes multiple nodes, and the multiple nodes include a management node. The task and data management device provided by the present application is deployed on the management node. The task and data management device provided by the present application includes an acquisition module, a first determination module, a second determination module, a third determination module, a fourth determination module and a sending module, wherein the acquisition module is used to acquire memory access information of memory access instructions in each of the multiple nodes; the first determination module is used to determine the ownership relationship between the thread and the data segment, the ownership relationship indicating the data segment owned by each thread in each of the multiple nodes, and the thread task to which each data segment in each of the multiple nodes belongs; the second determination module is used to determine the ownership relationship between the thread and the data segment based on the access instruction; The memory access information of the storage instruction is used to determine the tuning object, the tuning object includes the target thread or the target data segment, and the target thread or the target data segment has degraded access; the third determination module is used to determine the target association domain corresponding to the tuning object based on the ownership relationship between the thread and the data segment, the target association domain includes the tuning object, and the threads and data segments related to the tuning object; the fourth determination module is used to determine the scheduling decision of each thread in the association domain and the migration decision of each data segment; the sending module is used to send the scheduling decision of each thread to the first node where the thread is located, so that the first node schedules the thread task based on the received scheduling decision, and send the migration strategy of each data segment to the second node where the data segment is located, so that the second node migrates the data segment based on the received migration strategy.
[0039] In a possible implementation, the acquisition module is specifically used to: receive sampling data sent by a hardware sampler deployed on each NUMA node among the multiple nodes, where the sampling data includes memory access information of a memory access instruction.
[0040] In another possible implementation, when the sampled data collected by the hardware sampler reaches a preset size, the hardware sampler sends the collected sampled data to the management node.
[0041] Optionally, the hardware sampler is SPE or PEBS.
[0042] In another possible implementation, the memory access information of the memory access instruction includes the execution time of the memory access instruction, the memory access address, and the thread to which the memory access instruction belongs; the first determination module is specifically used to determine the ownership relationship between the current thread and the data segment based on the execution time of the memory access instruction, the memory access address, and the thread to which the memory access instruction belongs.
[0043] In another possible implementation, a specific implementation of determining the ownership relationship between the current thread and the data segment based on the execution time of the memory access instruction, the memory access address, and the thread to which the memory access instruction belongs is: based on the execution time of the memory access instruction, the memory access address, and the thread to which the memory access instruction belongs, determining a number of data pages that each current thread task has ownership of; and aggregating the several data pages to determine the data segment that each thread task has ownership of.
[0044] In another possible implementation, a number of data pages are aggregated to determine a data segment that each thread has ownership of. A specific implementation is: obtain a number of valid data pages from a number of data pages that each thread has ownership of, where a valid data page has an access frequency greater than a first preset threshold; aggregate the valid data pages whose virtual address distance is less than a second preset threshold among the number of valid data pages to obtain a data segment that each thread has ownership of.
[0045] In another possible implementation, the ownership relationship between the thread and the data segment is determined based on ownership relationship marking information, where the ownership relationship marking information marks the data segment that each thread in each node among multiple nodes has ownership; the ownership relationship marking information is obtained based on data application operations of each thread task captured at runtime; or, the ownership relationship marking information is obtained based on information input by a user.
[0046] In one example, the ownership relationship between a thread and a data segment is determined and recorded in a mapping table in a bidirectional index structure; the mapping table includes a thread index and a data index, the thread index is used to find a data segment owned by a thread task through a thread, and the data index is used to find a thread task to which a data segment belongs through a data segment.
[0047] In another possible implementation, the mapping table further records one or more of the node where each thread is located, the node where the data segment is located, and the access frequency of the data segment to which each thread has ownership.
[0048] In another possible implementation, the memory access information of the memory access instruction also includes one or more of the CPU running node corresponding to the memory access instruction, the memory access delay, and the memory access read and write type; the second determination module is specifically used to: determine the data profile between each thread and the data segment to which it owns based on the ownership relationship between the thread and the data segment and the memory access information of the memory access instruction, the data profile depicts the memory access characteristics of the data segment to which each thread task owns; based on the data profile, determine the tuning object.
[0049] Optionally, the memory access feature includes one or more of a historical memory access pattern, a memory access ratio within a node or between nodes, a memory access heat, and a memory access delay.
[0050] In another possible implementation, the task and data management device provided by the present application also includes a display module, which is used to display the data portrait for the convenience of users or tuning experts to view. Further analysis can be performed through the data portrait to supplement some thread scheduling decisions or data migration decisions.
[0051] In an example, the degraded access condition includes one or more of remote access, access delay greater than a third preset threshold, and bandwidth occupancy greater than a fourth preset threshold.
[0052] In another possible implementation, the third determination module is specifically used to: determine a thread or data segment that has an ownership relationship with the tuning object as a first associated object; determine a thread or data segment that has an ownership relationship with the first object as a second associated object; after several calculation iterations, obtain N associated objects, N is a positive integer; based on the tuning object and the N associated objects, determine the target associated domain corresponding to the tuning object.
[0053] In another possible implementation, determination of the associated object is also related to a propagation threshold. When the access frequency between a thread or a data segment and an object in a target associated domain is greater than or equal to the propagation threshold, the thread task or the data segment is determined as an associated object.
[0054] Optionally, the number of calculation iterations is a preset number.
[0055] In another possible implementation, the fourth determination module is specifically used to: calculate the scores of multiple scheduling decisions for each thread in the association domain, multiple scheduling strategies indicate that each thread is scheduled from the current node to other associated nodes, the associated node is the node where the thread or data segment in the target association domain is located, and the score of the scheduling decision is used to evaluate the access performance of each thread to the data segment to which it has ownership relationship after the scheduling decision is executed; use the scheduling decision with the highest score among the multiple scheduling decisions as the scheduling decision for each thread in the association domain; calculate the scores of multiple migration decisions for each data segment in the association domain, multiple migration strategies indicate that each data segment is migrated from the current node to other associated nodes, and the score of the migration decision is used to evaluate the access performance of each data segment by the thread to which it belongs after the migration decision is executed; use the migration decision with the highest score among the multiple migration decisions as the migration decision for each data segment in the association domain.
[0056] In one example, the score of the scheduling decision is determined based on the access delay optimization amount and the scheduling cost after the thread is scheduled; the score of the migration decision is determined based on the access delay optimization amount and the migration cost after the data segment is migrated.
[0057] In another possible implementation, the task and data management device provided by the present application also includes a detection module, which is used to determine whether the scheduling decisions of each thread and the migration decisions of each data segment meet the executable conditions; and discard the scheduling decisions and migration decisions that do not meet the executable conditions.
[0058] In another possible implementation, the executable conditions include one or more of the following: the memory space of the target node corresponding to the scheduling decisions of each thread and the migration decisions of each data segment is met, and the bandwidth between the current node and the target node corresponding to the scheduling decisions of each thread and the migration decisions of each data segment is met.
[0059] In another possible implementation, the sending module is specifically used to: send the scheduling decision of each thread as prompt information to the thread scheduler in the first node where each thread is located, the prompt information is used as an influencing factor for the thread scheduler to determine the thread scheduling policy, and the thread scheduler is used to schedule the threads according to the thread scheduling policy; send the migration strategy of each data segment to the second node where each data segment is located, so that the second node migrates the data segment based on the received migration strategy. A specific implementation is: send the migration strategy of each data segment to the data migration queue in the second node where each data segment is located, so that the second node executes the migration instruction in the data migration queue to migrate each data segment from the current node to the target node.
[0060] Optionally, the architecture of the computer system mentioned above is a NUMA architecture, and the multiple nodes are multiple NUMA nodes; or the computer system includes multiple Hosts, and the multiple nodes are multiple Host nodes.
[0061] In a third aspect, an embodiment of the present application provides a computing device, including a memory and a processor, wherein the memory stores instructions, and when the instructions are executed by the processor, the method described in the first aspect is implemented.
[0062] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method described in the first aspect is implemented.
[0063] In a fifth aspect, an embodiment of the present application further provides a computer program or a computer program product, wherein the computer program or the computer program product comprises instructions, which, when executed, cause a computer to execute the method described in the first aspect.
[0064] In a sixth aspect, an embodiment of the present application further provides a chip, comprising at least one processor and a communication interface, wherein the processor is used to execute the method described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] Figure 1 A schematic diagram of an SMP architecture;
[0066] Figure 2 A schematic diagram of a NUMA architecture;
[0067] Figure 3 A schematic diagram of an AutoNUMA architecture;
[0068] Figure 4 This is a schematic diagram of an implementation method of AutoNUMA;
[0069] Figure 5 A schematic diagram of the AutoNUMA algorithm implementation process is shown;
[0070] Figure 6 An implementation architecture diagram of the task and data management method provided in an embodiment of the present application is shown;
[0071] Figure 7 A schematic diagram showing a method for managing tasks and data provided by an embodiment of the present application applied to a NUMA server scenario;
[0072] Figure 8 A schematic diagram showing the application of the task and data management method provided in the embodiment of the present application to the UB unified interconnection scenario;
[0073] Fig. 9An implementation architecture diagram of the task and data management method provided in an embodiment of the present application is shown;
[0074] Fig.10 A flowchart of a specific implementation method of the task and data management method provided in an embodiment of the present application is shown;
[0075] Fig.11 A schematic diagram showing a specific implementation of the embodiment of the present application in a single host scenario of a NUMA architecture server is shown;
[0076] Fig.12 A schematic diagram showing a specific implementation of the embodiment of the present application in a UB unified interconnection multi-host scenario;
[0077] Fig.13 A method flow diagram of a task and data management method provided by an embodiment of the present application is shown;
[0078] Fig.14 A schematic diagram of the structure of a task and data management device provided in an embodiment of the present application;
[0079] Fig.15 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0080] The term "and / or" mentioned in this article is a kind of relationship that describes the association of associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The symbol " / " in this article indicates that the associated objects are in an or relationship, for example, A / B means A or B.
[0081] The terms "first", "second", etc. in the specification and claims herein are used to distinguish different objects rather than to describe a specific order of objects. For example, a first NUMA node and a second NUMA node are used to distinguish different NUMA nodes rather than to describe a specific order of NUMA nodes.
[0082] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0083] In the description of the embodiments of the present application, unless otherwise specified, "multiple" means two or more than two. For example, multiple processing units refer to two or more processing units, etc.; multiple elements refer to two or more elements, etc.
[0084] To facilitate understanding of the solutions of the embodiments of the present application, the technical terms involved in this document are first explained below.
[0085] Ping-pong migration: When multiple tasks located on different nodes access the same memory block at the same time and remote access causes data migration, the original local access becomes remote access. In the subsequent cross-node access detection, the data will be migrated back again, resulting in repeated migration of data between several nodes. This phenomenon is called ping-pong migration.
[0086] Automatic NUMA Balancing: An automatic NUMA system application performance optimization tool developed by Red Hat (hereinafter referred to as AutoNUMA). AutoNUMA aims to reduce the situation where tasks access data across nodes, hoping to improve application performance.
[0087] Arm Statistical Profiling Extension (SPE): ARM Statistical Profiling Extension (hereafter referred to as SPE) is an optional feature in ARMv8.2 hardware. SPE allows CPU instructions to be sampled and associated with the source code location where the instruction occurred.
[0088] PEBS: is a debug storage mechanism in processors based on the Intel NetBurst microarchitecture. PEBS allows precise architectural information associated with one or more performance events to be saved in a precise event record buffer.
[0089] Ownership relationship: refers to the corresponding ownership relationship between tasks and data during runtime. The ownership here includes both the control rights of tasks over data allocation, transfer, and release, as well as the right to access data. Due to the different principles of data perception, the reliability of ownership information sources varies. When downstream tasks need to specifically distinguish between control rights or access rights, they can be judged based on the source of information. At the same time, when the boundaries of control rights and access rights are unclear (such as data rearrangement tasks, etc.), incomplete information input methods such as sampling can also be used as the only source of ownership information. In the application embodiment, the task granularity is thread.
[0090] Association domain: One of the relationship sets that the data / thread placement decision of the embodiment of the present application depends on. The physical meaning is all threads and data segments that may be affected when a thread / data segment is relocated. With the help of the thread-data ownership bidirectional mapping structure in the embodiment of the present application, when the placement demand comes, iterative calculation can be performed at runtime to obtain the association domain where a thread / data segment is located. At the same time, the convergence speed of the iterative calculation can be adjusted by setting the threshold heat (access frequency within a time range) of the iterative calculation of the association domain.
[0091] AutoNUMA is a NUMA architecture remote access optimization tool, which aims to improve the performance of applications running on NUMA hardware. Figure 3 described.
[0092] by Figure 4 For example, assume that thread b is scheduled from NUMA node 0 to NUMA node 1. In order to find data in memory that meets the remote access migration strategy, AutoNUMA first scans and marks some data pages in the address space of process X according to a certain rule, and modifies its PTE flag to prot_none; when the marked data page is accessed, prot_none triggers a page fault exception, which is called a NUMA hint page fault; during the interrupt, AutoNUMA obtains the information of the thread that triggered the interrupt and the node where the data it accessed is located. If the two nodes are inconsistent (such as Figure 4 In the example, thread b and data page b are located at NUMA nodes 1 and 0 respectively, indicating that this access is a remote access. At this time, the above NUMA node information is saved in the remote access queue; the information in the queue will be cyclically detected, and whether to migrate will be determined based on the target node's memory free status, data page read and write permissions and other conditions.
[0093] Figure 5 A schematic diagram of the AutoNUMA algorithm implementation process is shown.
[0094] The above scheme can achieve process-level cross-node access behavior sampling and processing, and can achieve low-cost remote access identification. However, AutoNUMA has the following shortcomings: (1) The AutoNUMA marking process is carried out within the process VMA and cannot establish a corresponding relationship with a specific thread; (2) The accessed data information is at page granularity, and the marked pages cannot be aggregated with the associated pages to form data segments, so as to be placed in a unified batch; (3) Task-triggered: AutoNUMA triggers NUMAhint page faults when the task is running, and locates the data accessed by the task in the page fault. This method cannot actively locate the accessor thread from the data end. In summary, AutoNUMA does not establish thread-level task-data association, cannot perform batch migration of the entire set / subset of data used by the thread, and cannot actively analyze the rationality of the placement of a certain data segment.
[0095] In addition, remote access optimization also needs to consider the data sharing between tasks. When a piece of data is shared by multiple nodes and multiple tasks, simply migrating the data cannot eliminate remote access and may cause "ping-pong migration".
[0096] In response to the above problems, an embodiment of the present application provides a task and data management method, and provides a set of adaptive automatic tuning or management mechanisms. By acquiring memory access information of memory access instructions in each of multiple nodes, the system status is sensed. When it is sensed that the system status is not good, for example, under the current thread / data distribution, there are threads / data with degraded access conditions (such as remote access), the threads / data with degraded access are actively tuned to reduce remote access and improve the overall system performance.
[0097] The technical solution of the present application is further described in detail below through the accompanying drawings and embodiments.
[0098] Figure 6 FIG. 1 shows an implementation architecture diagram of the task and data management method provided in the embodiment of the present application. Figure 6 As shown, the task and data management method provided in the embodiment of the present application can be applied to a computer system with a NUMA architecture. The architecture includes a hardware sampling system and a software analysis system, wherein the hardware sampling system is responsible for real-time sampling and transmission of memory access information, and the software analysis system performs feature clustering and decision analysis based on the sampling information, and gives real-time data / task placement decisions (i.e., task scheduling decisions and data migration decisions).
[0099] The hardware sampling system is deployed on each NUMA node for hardware sampling. Depending on the architecture (ARM / x86), it relies on SPE / PEBS (i.e., ARM architecture uses SPE for hardware sampling, and x86 architecture uses PEBS for hardware sampling) hardware sampling to provide basic information such as memory access instruction execution timestamp, memory access PA and VA, thread number, CPU running node, memory access latency, memory access read and write type, etc.
[0100] The software analysis system is located in the operating system kernel, including a feature cluster analyzer, a correlation domain calculator, a decision analyzer and a data / task placer. The feature cluster analyzer includes a discrete information aggregation module and a bidirectional mapping calculation module. The discrete information aggregation module is used to receive real-time hardware sampling information, aggregate the discrete memory access data of each thread into a continuous data segment, and combine the runtime thread memory allocation and the thread VA allocation defined by the program interface to give the thread & data segment ownership range. The bidirectional mapping calculation module is used to maintain and save the ownership bidirectional mapping data structure according to the access relationship between threads and data segments.
[0101] When a data segment / thread triggers a migration demand, the association domain calculator calculates the association domain where the data segment / thread is located based on the ownership bidirectional mapping data structure.
[0102] The decision analyzer includes a placement decision analysis module and a placement decision detection module. The placement decision analysis module is used to assume that the system load state remains unchanged after the placement decision is executed, and to evaluate the policy value of each thread / data segment in the association domain when it is migrated to each NUMA node involved in the association domain. And from all sub-strategies, select the optimal sub-strategy (with positive value) for each thread / data segment, and combine them to form an optimal policy set. The placement decision detection module is used to detect whether the given decision meets the executable conditions. The executable conditions include the available memory size / available computing resources of the target node, the available bandwidth size between the source and target nodes, the VMA interval (heap / stack / code segment / static data segment) where the data segment is located, etc.
[0103] The data / task placer is used to enable data / thread relocation based on the placement decision. It enables additional threads for data, polls the data segments to be migrated, and performs batch migration. It gives scheduling hints to the scheduler (such as CFS scheduler) for tasks.
[0104] The task and data management method provided in the embodiment of the present application can be applied to NUMA server scenarios.
[0105] Figure 7 A schematic diagram showing the application of the task and data management method provided in the embodiment of the present application to a NUMA server scenario. Figure 7As shown, in the NUMA server scenario, a real-time adaptive task-data management tuning tool can be implemented based on the embodiment of the present application, and the tool can be used as a system runtime tuning component. Each node deploys a hardware sampling / ownership marker, so the sampling information can be transmitted to the association domain calculator on a certain node through the interconnect bus to uniformly perform ownership association, feature profiling, and association domain calculations. At the same time, the decision analyzer calculates, evaluates, and combines decisions based on real-time association domains, and distributes them to each NUMA node for execution again. During the entire management process, hardware sampling is decoupled from software decision-making requirements, and the lower cost of hardware sampling is utilized to achieve global thread-data ownership and real-time memory access feature management, greatly improving the coverage of factors affecting migration decisions and eliminating ping-pong migrations.
[0106] The task and data management method provided in the embodiment of the present application can also be applied to other scenarios besides the NUMA server scenario, such as the UB unified interconnection scenario.
[0107] Figure 8 The following is a schematic diagram showing the application of the task and data management method provided in the embodiment of the present application to the UB unified interconnection scenario. Figure 8 As shown, in the UB unified interconnection scenario, unified memory management between hosts and between hosts and memory nodes can be implemented based on the task and data management method provided in the embodiment of the present application. Each host in the scenario is equipped with an ownership manager, and any of the managers is set as the primary manager (for example Figure 8 In the figure, Host 1 is the host. The Ownership Manager has two functions: (1) sampling memory access instructions related to this Host (within the Host and between Hosts); (2) aggregating, calculating and generating the ownership bidirectional association substructure involved in this Host. In addition, the memory node only sets the ownership sampler, and the management operation of its sampled data is uniformly transmitted to the main manager for execution. On the other hand, after the bidirectional association substructure of each Host and memory node is calculated, it is uniformly transmitted to the main manager through the switch and interconnection bus for information synchronization and substructure splicing to form a full-scenario bidirectional association relationship and draw the corresponding portrait. Subsequent data segment migration decisions and thread scheduling decisions are made in the main manager, and are calculated and analyzed based on the global association.
[0108] It needs to be explained that the ownership relationship and ownership association relationship mentioned in the context of the embodiments of the present application have the same meaning, and both express the ownership relationship between threads and data segments.
[0109] The following describes the detailed implementation of the task and data management method provided in the embodiment of the present application.
[0110] Fig. 9 An implementation architecture diagram of the task and data management method provided in an embodiment of the present application is shown.
[0111] Fig.10 A flowchart of a specific implementation method of the task and data management method provided in the embodiment of the present application is shown. Fig.10 As shown, the task and data management method provided in the embodiment of the present application at least includes steps S1 to S10.
[0112] Through step S1, the system enables the fine-grained "task-data" management component and starts runtime data feature perception.
[0113] In step S2, data feature perception is performed as an information input module of the fine-grained "task-data" management method. There are multiple input methods, such as one or more combinations of hardware sampling, runtime association tags, and opening APIs to users.
[0114] One implementation of hardware sampling is SPE / PEBS hardware sampling, that is, SPE hardware sampling in ARM architecture and PEBS hardware sampling in x86 architecture. Sampling is performed synchronously with subsequent association management, decision analysis, etc., and system memory access instructions and related information are taken in real time. Hardware sampling is the only means to obtain data memory access features, which is used to support data placement decision analysis; at the same time, it can sample task-data correspondence and can also be used for data ownership estimation when active marking methods are missing.
[0115] Runtime association marking is an active thread-data association marking method. It captures thread stack information at runtime and automatically captures the memory corresponding to specific data application operations (such as mmap, malloc) in the thread to perform thread-data association marking.
[0116] The way to open the API to users is that users specify the correspondence between threads and data in the program.
[0117] Compared with hardware sampling, runtime association tagging and user API are both active tagging methods, which can give an accurate definition of thread-data ownership relationship, but lack memory access feature acquisition and can only be used for data ownership tagging.
[0118] In step S3, taking each thread as a unit, adjacent discrete data points in its access information are adaptively aggregated to form a continuous data segment.
[0119] Through step S4, the bidirectional association of task-data ownership is realized. First, thread ownership is performed, and the corresponding relationship of data segments owned by each thread derived by active association mark / sampling information aggregation is maintained. Among them, the ownership obtained by active association mark is an accurate relationship, which can be used for various activities such as data authentication and data placement decision. The ownership formed by sampling information aggregation is an estimated relationship, which is only used as a real ownership estimate for data placement decision activities.
[0120] Then aggregate the data segment information. The aggregated data segment is aggregated from the sampling instruction information set, which contains the aggregated data segments and their visitor thread sets, and can set thresholds to filter visitor access popularity. At the same time, the aggregated data segment is used as the basic unit to store the data access characteristics in the sampling information and is used for data placement decision activities.
[0121] Finally, a bidirectional mapping relationship between thread and data ownership is constructed. According to the relationship between "data" and "thread" in the thread ownership and aggregated data segment information, a bidirectional mapping structure is constructed. Among them, if the thread ownership comes from the active association tag, there may be a situation where the "thread-owned data segment" and the "sampled aggregated data segment" do not completely correspond (such as a single aggregated data segment spanning two threads, etc.). At this time, the "sampled aggregated data segment" will be split based on the thread-owned data segment and represented as the memory access features of the two threads respectively. If the thread ownership comes only from hardware sampling & aggregation, there is no incomplete correspondence problem because the data sources of the two are the same.
[0122] In step S5, an offline data portrait is generated. According to the ownership bidirectional mapping and the corresponding memory access characteristics, the historical memory access pattern (VA distribution), the memory access ratio within / between nodes, the memory access heat, the memory access delay and other information are analyzed, and various offline portraits are formed for intuitive analysis of memory access characteristics.
[0123] The migration demand starting point is determined in step S6, that is, the migration demand starting point search is performed. Specifically, the thread / data segment is used as the analysis object to evaluate the degraded access of the object in the profile. For example, if some objects have frequent remote access, it is used as one of the demand starting points.
[0124] In step S7, the association domain is calculated. Starting from the starting point of the migration demand, the entire set of association domains where the starting point is located is iteratively calculated. First, the association domain propagation threshold (access heat) is set. When the access frequency between threads and data segments is greater than the threshold, the threads / data segments that are not added to the association domain are added to the association domain.
[0125] In step S8, sub-migration strategy evaluation is performed. Exemplarily, assuming that the system load state remains unchanged after the placement decision is executed, the strategy value of each thread / data segment in the association domain is evaluated when it is migrated to each NUMA node involved in the association domain. And from all sub-strategies, the optimal sub-strategy (with a positive value) for each thread / data segment is selected respectively, and combined to form an optimal strategy set, which is the placement decision set, including the scheduling decision set of threads and the migration decision set of data.
[0126] Optionally, the policy value evaluation standard is: access delay benefit before and after migration * access frequency – migration cost. When all policy values are negative, the optimal sub-policy is "no migration", and the corresponding policy value evaluation is 0.
[0127] It can be understood that the "migration cost" in the strategy value evaluation formula mentioned in this article can be understood as the delay in system performance caused by executing the migration operation.
[0128] In step S9, each strategy in the optimal strategy set is tested for placement decisions. For example, after obtaining the placement decision set, indicators such as the memory of the placement target node and the available bandwidth between nodes are tested, and unexecutable strategies are removed from the strategy set.
[0129] Finally, the task / data is placed and executed through step S10, all data pages in the data segment are migrated in batches, or thread scheduling prompts are given to the scheduler.
[0130] The following describes the specific implementation of the task and data management method provided in the embodiment of the present application when applied to a specific scenario.
[0131] Fig.11 The specific implementation diagram of the embodiment of the present application in a single host scenario of a NUMA architecture server is shown. Fig.11 As shown in the figure, in the single-host scenario of NUMA architecture server, the thread-data ownership relationship can be determined based on the runtime thread stack association and program input; at the same time, based on the sampling and aggregation of each NUMA node hardware sampler, the real-time memory access characteristics are added for each pair of thread-data association relationships. Finally, the hybrid tuning of data migration and task scheduling is realized based on this.
[0132] In this scenario, after a single host enables fine-grained "thread-data" management, the hardware samplers on NUMA node 1 and NUMA node 2 start sampling and transmit the sampling information to the association domain calculator on NUMA node 1 in units of a certain size (e.g., 4096 bytes) of memory space. In a single host scenario, the information owned by the association domain calculator on NUMA node 1 is the global memory access feature sample at the current moment. Therefore, a bidirectional association relationship between threads and data can be formed based on this complete set of samples, as shown in Fig.11 As shown in part ①. Among them: the association relationship is divided into thread index and data index. Any query can start from any thread or data segment, and through iterative mapping, it can finally search for its associated domain (such as data segment (Data seg) 1 to thread (Thread) 1 to Data seg 2). The thread index and data index respectively save the node location information where they are located. In each thread-data segment association, the corresponding access frequency information is saved. Real-time memory access features are extracted from the sampling & aggregation information and attached to the corresponding data index. Afterwards, the decision analyzer will query and calculate a certain association domain according to the real-time migration requirements, and enter the corresponding association domain analysis, such as Fig.11 As shown in part ②. Among them: each data segment and thread may correspond to multiple migration strategies. To evaluate the value of each strategy, the "access delay optimization amount" before and after migration minus the "migration cost" is used as the strategy value evaluation amount. Calculate the value of each strategy for each data segment and thread respectively, and select the strategy with the highest value for each data segment / thread. Note that when all strategy values are negative, the optimal strategy is "no migration" and the value is 0. Summarize all the optimal sub-strategies to form an optimal strategy set, which is sent to the downstream for decision detection.
[0133] Fig.12 The specific implementation diagram of the embodiment of the present application in the UB unified interconnection multi-host scenario is shown. Fig.12 As shown in the figure, in multi-host scenarios such as UB unified interconnection, thread-data association is not limited to the host, but can also span different hosts. Unified memory management is achieved through information transmission and integration between the master and slave ownership managers of different hosts.
[0134] In this scenario, after each host forms a bidirectional relationship between threads and data within the host through memory access information sampling and aggregation, it also needs to be synchronized to the ownership master manager to supplement the relationship between threads and data between hosts. The final relationship between threads and data is as follows: Fig.12 As shown in part ①. Among them: when calculating the association relationship within the Host, temporarily ignore the cross-Host access records in the sampling, and only consider the memory access information of the current Host. When merging the association relationship between two Hosts, all the different cross-Host memory access records of the two Hosts are added to the association relationship. At this time, the two Hosts are regarded as the same Host. After merging all Hosts, the global thread-data ownership bidirectional association relationship at that moment is obtained, and downstream tasks such as association domain calculation are further performed. The subsequent steps of association domain calculation, placement decision analysis, placement decision detection, task / data placement, etc. are the same as described above.
[0135] Fig.13The following is a flow chart of a method for managing tasks and data provided by an embodiment of the present application. The method can be used in any scenario to improve the performance of a computer system with multiple nodes, for example Figure 7 The single host server NUMA architecture scenario shown in the figure and Figure 8 The above scenario of unified interconnection of multiple hosts, etc. can realize active perception of system status, actively optimize threads / data with poor memory access performance, and improve the overall system performance. Fig.13 As shown, the task and data management method provided by the present application at least includes steps S1301 to S1306.
[0136] In step S1301, memory access information of a memory access instruction in each of a plurality of nodes is obtained.
[0137] Taking the application in NUMA architecture scenario as an example, a hardware sampler can be deployed in each NUMA node among multiple NUMA nodes to collect memory access information of memory access instructions currently generated by each NUMA node at a certain sampling frequency through hardware. The memory access information of each memory access instruction may include basic information such as memory access instruction execution timestamp, memory access PA and VA, thread number, CPU running node, memory access latency, memory access read and write type, etc. After the hardware sampler deployed in each NUMA node collects the memory access information of the memory access instruction, the collected memory access information is sent to the management node. The management node obtains the memory access information of the memory access instruction in each NUMA node among multiple NUMA nodes, that is, the memory access information of the global memory access instruction of the system is obtained.
[0138] Optionally, depending on the architecture, the hardware sampler may be a corresponding hardware sampler, for example, in the ARM architecture, the hardware sampler is SPE, and in the x86 architecture, the hardware sampler is PEBS.
[0139] Since the hardware sampler is independent of system load, user operations, and management decisions, it can collect information about memory access instructions with low overhead at runtime, thus enabling user-free perception of memory access features.
[0140] In one example, the hardware sampler sends the collected sampling data to the management node only when the sampling data collected by the hardware sampler reaches a preset size. That is, the hardware sampler on each NUMA node transmits sampling information to the management node in units of a certain size of memory space, for example, in units of 4096 bytes of memory space. When the sampling data collected by the hardware sampler occupies a memory space of 4096 bytes, the sampling data is sent to the management node. This avoids the loss of real-time performance due to excessive sampling data, and also avoids excessive computing costs due to frequent calculations of small sampling data.
[0141] Of course, in some other examples, sampling may also be performed by non-hardware methods, such as using software sampling to obtain memory access information of memory access instructions in each NUMA node, which is not limited in the embodiments of the present application.
[0142] In step S1302, the ownership relationship between the thread and the data segment is determined.
[0143] There are many ways to determine the ownership relationship between threads and data segments, such as determining based on hardware sampling information, determining by runtime association tags, and determining by opening an API interface to users.
[0144] The ownership relationship between the thread and the data segment can be determined based on hardware sampling information alone (also known as the hardware sampling method). Specifically, the ownership relationship between the thread and the data segment is determined using the memory access instruction execution timestamp, memory access VA and thread number in the memory access instruction information collected by SPE / PEB. For example, if the collected memory access instruction information is the first moment, the first VA and the first thread number, then it can be obtained that at the first moment, the first thread number accessed the first VA, and then it can be obtained that at the first moment, the thread corresponding to the first thread number has ownership of the data page corresponding to the first VA. A thread usually accesses multiple data pages through memory access instructions. Based on the collected memory access instruction information, several discrete data pages owned by the thread can be obtained, and several discrete data pages are aggregated to obtain several continuous data segments corresponding to the thread.
[0145] In the actual sampling process, for example, in a certain period of time, there may be VAs sampled only once, VAs sampled twice, VAs sampled four times, and VAs sampled a thousand times (that is, this memory data page is accessed a thousand times and is frequently accessed). At this time, if the data is directly used without any heat threshold screening, the result of aggregation is likely to be that a whole segment of data is aggregated, and the effect of aggregation does not achieve the purpose of splitting the data. For example, between two segments of data with high access heat (such as access frequencies of 500 and 800), one segment of data is only accessed once. If aggregation is performed without screening, the result is that the three segments of data are aggregated together to form a continuous data segment just because the data has been accessed once, which is not what we want.
[0146] Therefore, in order to achieve better aggregation effect, the access heat threshold can be set to filter out valid access data pages with high access heat for aggregation. Specifically, for any thread i, the access heat threshold is set to the access frequency of 5, then the data pages corresponding to thread i with access frequencies less than 5 are discarded as invalid accesses, and the data pages with access frequencies greater than or equal to 5 are aggregated as valid accesses, obtaining several data segments owned by thread i.
[0147] For example, the data pages owned by thread i include data page 1, data page 2, data page 3, data page 4, data page 5, and data page 6, where thread i accesses data page 1 at a frequency of 1000, data page 2 at a frequency of 500, data page 3 at a frequency of 3, data page 4 at a frequency of 800, data page 5 at a frequency of 900, and data page 6 at a frequency of 4. Then the valid accessed data pages are data page 1, data page 2, data page 4, and data page 5, where data page 1 and data page 2 are adjacently aggregated together to form continuous data segment 1, and data page 4 and data page 5 are adjacently aggregated together to form data segment 2. It is best to obtain data segment 1 and data segment 2 owned by thread i.
[0148] It can be understood that the thread number can also be called a thread identifier or thread ID, which is used to uniquely identify a thread. Adjacent data pages can be understood as two data pages whose VA is less than a preset distance. For example, if the interval between the virtual addresses of data page 1 and data page 2 is less than a preset distance, then data page 1 and data page 2 are determined to be adjacent.
[0149] By determining the ownership relationship between threads and data segments in a manner based on hardware sampling information, all actual memory access instructions in each NUMA node can be collected, and then the ownership relationship between global threads and data segments in each NUMA node can be collected.
[0150] You can also use runtime association marking to determine the ownership relationship between threads and data segments. For example, by capturing thread stack information at runtime, automatically grabbing the memory application operations (such as mmap, malloc, etc.) corresponding to the thread, marking the corresponding data segment owner as the current thread, and realizing runtime non-sensing marking.
[0151] Alternatively, you can open an API interface to users and receive user input to determine the ownership relationship between threads and data segments. For example, you can open an interface to users and allow programs to mark the ownership relationship between threads and data segments through system calls. Program API marking reflects user intentions. Compared with hardware sampling methods, the ownership relationship given by program APIs is more accurate and can be used for tasks with high determinism requirements, such as data authentication.
[0152] The ownership relationship between threads and data segments can also be determined by hardware sampling, runtime tagging, and API interface methods. Since the ownership relationship determined by the API interface method is the most accurate, followed by the runtime tagging method, and the hardware sampling method is the least accurate, when the ownership relationship between threads and data segments determined by the three methods conflicts, the ownership relationship determined by the API interface method shall prevail.
[0153] However, the runtime tagging method and API interface method may not define all ownership relationships. Although the hardware sampling method is not very accurate, it samples according to the actual operation of the system. Therefore, it can sample the ownership relationships during the operation of the system. By combining the three, the globality of the ownership relationships can be guaranteed while ensuring the accuracy of the ownership relationships.
[0154] In one example, the ownership relationship between the obtained thread and the data segment can be recorded in a mapping table in a bidirectional index structure, and the mapping table includes a thread index and a data index. The thread index is used to find the data segment owned by the thread task through the thread, and the data index is used to find the thread task to which the data segment belongs through the data segment. Compared with the related task-data management structure, the mapping relationship is a one-way mapping from task to data. There is a lack of corresponding structure for locating a certain data to the thread to which it belongs. It is necessary to locate the thread through a trigger method similar to AutoNUMA (triggering an interrupt and marking the visitor when the data is accessed). The trigger time is uncertain, and a large amount of interrupt costs are required to form a global portrait. The present application constructs and maintains a bidirectional mapping relationship between thread-data and data-thread, which greatly reduces the cost of locating data to thread.
[0155] Optionally, the mapping table further records one or more of the NUMA node where each thread is located, the NUMA node where the data segment is located, and the access frequency of the data segment owned by each thread.
[0156] In the issue of NUMA memory unified management and data / task placement tuning, the memory access performance differences between different NUMA / Hosts may change in real time. The bidirectional index "thread-data" ownership relationship provided in the embodiment of the present application, based on the runtime thread stack tag and the "thread-data" ownership tag defined by the user API, and the hardware sampling of memory access instruction features based on SPE / PEBS, can establish a thread-data global association relationship view, and can be updated in real time according to the new memory access relationship sampling, providing real-time decision-making basis for NUMA unified memory management and placement tuning.
[0157] In the related technology, the "task-data" management granularity is the process, and the process can correspond to its owned / accessible data through the VMA. Threads in the same process share the process VMA, but lack the structure and information to directly locate the data they own. In the data reordering problem caused by threads, the related technology often detects and migrates data at the process / data page granularity, resulting in suboptimal results. The embodiment of the present application realizes thread-granular data tagging by constructing a bidirectional association based on thread-data ownership, so that data can be aggregated and migrated based on thread ownership and thread access status. At the same time, threads can make scheduling decisions based on thread-granular data tags.
[0158] In the related art, the "task-data" mapping relationship is a one-way mapping from task to data. There is a lack of corresponding data structure to locate the owner thread of a certain data (segment), and it is necessary to locate the thread through a trigger method similar to AutoNUMA (triggering an interrupt and marking the visitor when the data is accessed). The trigger time of the above method is uncertain, and a large amount of interruption cost is required to form a global portrait. The embodiment of the present application constructs and maintains a bidirectional index association relationship based on marking and sampling information, so that the cost of locating data to threads is reduced in the work of association domain calculation, portrait construction, decision evaluation, etc., and supports the runtime execution and update of the above work.
[0159] In step S1303, a tuning object is determined based on the memory access information of the memory access instruction.
[0160] Through the memory access information of the memory access instructions in each NUMA node, the thread / data segment with degraded access is obtained, and the thread / data segment is the tuning object that needs to be tuned. The degraded access situation includes one or more of remote access, excessive access latency, and excessive bandwidth usage.
[0161] Exemplarily, based on the analysis of information such as memory access PA, CPU running node, memory access latency, memory access read and write type in the memory access information of the memory access instruction, whether the thread / data segment has degraded access, for example, if the memory access latency is greater than the set threshold, the thread / data segment is judged as degraded access, and the NUMA node where the thread is located and the NUMA node where the data segment is located are not the same NUMA node. At this time, the thread-data segment is judged to be a remote access, and then judged as a degraded access.
[0162] In another example, the threads / data segments that need to be tuned can also be determined by means of data profiling. For example, based on the ownership relationship between the thread and the data segment and the memory access information of the memory access instruction, the data profile between each thread and the data segment to which it owns is determined. The data profile describes the memory access characteristics of each thread for the data segment to which it owns. Based on the data profile, the tuning object is determined.
[0163] Optionally, the memory access feature includes one or more of a historical memory access pattern, a memory access ratio within a node or between nodes, a memory access heat, and a memory access delay.
[0164] For a set of threads and data segments with ownership relationships, there are multiple types of data portraits, each of which describes a type of memory access feature. For example, two memory access information are extracted from the memory access information of the memory access instruction as two variables. For example, the variables can be selected from VA / PA, thread number, NUMA node where the data segment is located, and NUMA node where the CPU is located as needed. Then, one information (such as memory access latency, access read / write type) is selected as the dependent variable according to the needs, and the three information construct the data portrait.
[0165] For example, the first variable is the NUMA node where the CPU is located, the second variable is the NUMA node where the data is located, and the information is the access delay. A two-dimensional data portrait is constructed. The colors in the figure represent the high and low access delays. From the data portrait of the access delay, it can be seen that the task is concentrated on that NUMA node with a higher delay, and at the same time, the data on that NUMA node has a higher access delay. In this way, it can be seen that there are imbalanced accesses on those NUMA nodes in the specific system, and then it can be extracted from which NUMA nodes the remote access is concentrated on. This is to build a data portrait from the perspective of the node. Of course, we also construct the horizontal axis as time and the vertical axis as virtual address, and then the information can be the number of accesses, and the color depth expresses the high and low number of accesses to build a data portrait of access heat. For a certain VA, dark colors represent more accesses during this period, and light colors represent fewer accesses. Through the data portrait of access heat, we can intuitively see which data is hot data and will be frequently accessed. The access performance of this data has a greater impact on the performance of the system.
[0166] In one example, the data profile of each thread-data segment can be visualized and displayed to the user or tuning expert, so that the user can understand the global performance of the system in real time. In addition, the tuning expert can make further analysis through the data profile and supplement some decisions.
[0167] In step S1304, based on the ownership relationship between the thread and the data segment, the target association domain corresponding to the tuning object is determined.
[0168] After determining the thread or data segment that needs to be tuned, determine the target association domain corresponding to the tuning object based on the ownership relationship between the thread and the data segment.
[0169] Exemplarily, when it is detected that thread 1 has a degraded access situation according to the memory access characteristics, thread 1 is determined as a tuning object. According to the ownership relationship between the thread and the data segment, the data segments owned by thread 1 are searched through the thread index, including data segment 1, data segment 3, and data segment 6. At this time, thread 1, data segment 1, data segment 3, and data segment 6 are added to the association domain corresponding to thread 1. Then, the threads to which data segment 1, data segment 3, and data segment 6 belong are searched through the data index respectively, and the threads that are not in the association domain are added to the association domain. For example, it is found that the threads corresponding to data segment 1 include thread 1, thread 3, and thread 5, the threads corresponding to data segment 3 include thread 1, thread 2, and thread 6, and the threads corresponding to data segment 5 include thread 1, thread 2, thread 7, and thread 8. Thread 2, thread 3, thread 5, thread 6, thread 7, and thread 8 are added to the association domain corresponding to thread 1. After multiple iterative calculations, the data segments and threads related to thread 1 are finally found, that is, all the data segments and threads affected after thread 1 is scheduled. These data segments and threads constitute the association domain corresponding to thread 1.
[0170] After actual verification, we found that if we ignore the access popularity and allow the associated domain to propagate and expand, all threads and data segments related to thread 1 will be added to the associated domain corresponding to thread 1. The subsequent calculation amount will be very large, affecting the optimization speed. Therefore, in an example, we set a propagation threshold and calculate the associated domain corresponding to thread 1 through the propagation threshold.
[0171] For example, the propagation threshold may be an access frequency threshold, such as an access frequency threshold of 10. Data segments / threads with access frequencies less than 10 are added to the association domain, and propagation is cut off. Taking thread 1 as an example, the data segments owned by thread 1 include data segment 1, data segment 3, and data segment 6, but thread 1's access frequency to data segment 6 is less than 10, so data segment 6 is discarded, and only data segments 1 and 3 are added to the association domain. In the next iterative calculation, the threads corresponding to data segment 1 include thread 1, thread 3, and thread 5, and the threads corresponding to data segment 3 include thread 1, thread 2, and thread 6. The access frequencies between threads and data segments are checked, and it is found that thread 3's access frequency to data segment 1 and thread 2's access frequency to data segment 3 are both less than 10. After this iterative calculation, thread 5 and thread 6 are added to the association domain corresponding to thread 1.
[0172] In another example, the propagation threshold also includes the number of iterative calculations. For example, the number of iterative calculations is set to 5, and the correlation domain corresponding to thread 1 is obtained after the iterative calculations converge or after 5 iterative calculations.
[0173] by Fig.11As shown in the figure, when Data Seg1 is the tuning object, the association domain corresponding to Data Seg1 is calculated. First, the ownership relationship between the thread and the data segment is searched through the data segment index, and the thread to which Data Seg1 belongs is Thread1. The access frequency x1 of Thread1-Data Seg1 is greater than 10, then Thread1 is added to the association domain corresponding to Data Seg1. Iterative calculation is performed again, and the ownership relationship between the thread and the data segment is searched through the thread index. It is found that the data segments owned by Thread1 include Data Seg1 and Data Seg2, and the access frequencies x1 and x2 of Thread1-Data Seg1 and Thread1-Data Seg2 are both greater than 10, then Data Seg2 is added to the association domain corresponding to Data Seg1. Iterative calculation is performed again, and it is found that the threads to which Data Seg1 and Data Seg2 belong are both Thread1. At this time, convergence is achieved, and the association domain corresponding to Data Seg1 is obtained as Data Seg1-Thread1-Data Seg2.
[0174] From the above description, we can know that by starting from the scheduling object and based on the ownership association relationship of the bidirectional index, we can quickly iterate and calculate the association domain set to which the starting thread / data segment belongs. The physical meaning of the association domain is all threads and data segments that may be affected when a thread / data segment is relocated, which is used to support subsequent decision evaluation.
[0175] In step S1305, the scheduling decision of each thread and the migration decision of each data segment in the association domain are determined.
[0176] After determining the affinity domain, the scheduling decision of each thread and the migration decision of each data segment in the affinity domain are calculated. For example, taking any thread i as an example, the affinity domain corresponding to thread i includes thread 1, data segment 1, data segment 2 and thread 3. Thread 1 and data segment 1 are both on NUMA node 1, data segment 2 is on NUMA node 2, and thread 3 is on NUMA node 3. The scheduling decision of thread 1 includes scheduling strategy 1 and scheduling decision 2, where scheduling decision 1 is to schedule thread 1 from NUMA node 1 to NUMA node 2, and scheduling strategy 2 is to schedule thread 1 from NUMA node 1 to NUMA node 3. Then, the scores of scheduling decision 1 and scheduling decision 2 are evaluated respectively. The higher the score, the better the scheduling decision.
[0177] The scoring calculation formula for each scheduling strategy is: access delay benefit before and after migration * access frequency - migration cost, where the access delay benefit before and after migration means how much the access delay after migration is reduced compared to the access delay before migration, which can be obtained by subtracting the access delay after migration from the access delay before migration.
[0178] The scheduling decision with the highest scheduling decision score in the scheduling decision set of thread 1 (including scheduling decision 1 and scheduling decision 2) is used as the scheduling decision of thread 1. However, when the scores of all scheduling decisions in the scheduling decision set of thread 1 are negative, that is, after scheduling according to the scheduling decision, the access delay will become larger, or the overall performance of the system will be negatively affected after scheduling, at this time, the scheduling decision of thread 1 is not to schedule.
[0179] According to the above method, the scheduling decisions of all threads and the migration decisions of data segments in the association domain corresponding to thread i are calculated, including the scheduling decision of thread 1, the scheduling decision of thread 3, the migration decision of data segment 1 and the migration decision of data segment 2.
[0180] In another example, in order to ensure the executability of the calculated thread scheduling decisions and data migration decisions in the actual environment, the executability of the scheduling decisions and data segment migration decisions of all threads in the associated domain corresponding to thread i is also included.
[0181] Optionally, the executable conditions include one or more of the following: the memory space of the target NUMA node corresponding to the scheduling decisions of each thread and the migration decisions of each data segment meets the standard, and the bandwidth between the current NUMA node and the target NUMA node corresponding to the scheduling decisions of each thread and the migration decisions of each data segment meets the standard. When the executable conditions of the scheduling decision and the migration decision are met, it is determined that the data migration or thread scheduling can be performed through the executable test; when the executable conditions of the scheduling decision and the migration decision are not met, it is determined that the scheduling decision and the migration decision have not passed the executable test and do not meet the scheduling or migration conditions, and the scheduling decision or the migration decision is discarded and recalculated.
[0182] Taking the migration decision of data segment 2 as an example, the migration decision of the data segment is to migrate data segment 2 from NUMA node 2 to NUMA node 3. The feasibility of the migration decision is checked. If the target NUMA node 3 to which data segment 2 is to be migrated has sufficient memory space (that is, the memory space is larger than the size of data segment 2), and the bandwidth between NUMA node 2 and NUMA node 3 is also sufficient (that is, greater than the bandwidth required to migrate data segment 2), then the migration decision of data segment 2 passes the test and can be used as the migration decision of data segment 2 for migration.
[0183] The embodiment of this application is based on the latest access feature portrait, and through the quantitative indicators of access frequency and access latency, it evaluates the value of each thread's scheduling decision and each migration decision of the data segment, and selects the highest value sub-decision to form the optimal decision set. Compared with the traditional policy decision-making method, it provides quantitative policy evaluation standards and processes, and considers factors such as data sharing and popularity, adapts to a wider range of tuning scenarios, and provides a more fine-grained tuning policy set.
[0184] In step S1306, the scheduling decision of each thread is sent to the first node where each thread is located, and the migration strategy of each data segment is sent to the second node where each data segment is located.
[0185] After the above steps, the scheduling decisions of each thread and the migration decisions of each data segment in the associated domain corresponding to the thread / data segment that needs to be tuned are obtained. For the scheduling decision of any thread i in the associated domain, the management node sends the scheduling decision of thread i as a prompt to the CFS scheduler of the node where thread i is located, so that the CFS scheduler considers the scheduling decision of thread i when scheduling the thread. For example, the CFS scheduler comprehensively considers factors such as load balancing and the scheduling decision of thread i, and determines to schedule thread i from the current NUMA node to the target NUMA node.
[0186] Of course, in some other examples, the embodiments of the present application may also set up a scheduler a parallel to the CFS scheduler, and the management node sends the scheduling decision of thread i to scheduler a, and scheduler a executes the scheduling decision of thread i and schedules thread i from the current NUMA node to the target NUMA node.
[0187] For the migration decision of any data segment j in the associated domain, the management node sends the migration decision of data segment j to the data migration queue of the NUMA node where data segment j is located, and the migration thread executes the migration instruction in the data migration queue to migrate data segment j from the current NUMA node to the target NUMA node. The data segment is a continuous data segment that aggregates several data pages. The migration is performed in units of data segments, which realizes batch migration, increases migration efficiency, and reduces the overhead caused by frequent data migration.
[0188] Based on the same concept as the above-mentioned embodiment of a task and data management method, the present application embodiment also provides a task and data management device 1400, which can be deployed in a computer system, for example Figure 7 and Figure 8 In the computer system shown, threads / data with degraded access are actively tuned to reduce remote access and improve the overall performance of the system. The task and data management device 1400 includes a device for implementing Figure 6-13The tasks and data management methods shown are units or modules of each step.
[0189] Fig.14 A schematic diagram of a task and data management device provided in an embodiment of the present application. Fig.14 As shown, the task and data management device 1400 at least includes an acquisition module 1401, a first determination module 1402, a second determination module 1403, a third determination module 1404, a fourth determination module 1405 and a sending module 1406, wherein the acquisition module 1401 is used to acquire memory access information of memory access instructions in each of a plurality of nodes; the first determination module 1402 is used to determine the ownership relationship between threads and data segments, the ownership relationship indicating the data segments owned by each thread in each of a plurality of nodes, and the thread tasks to which each data segment in each of a plurality of nodes belongs; the second determination module 1403 is used to determine the tuning object based on the memory access information of the memory access instruction, and the tuning object includes the target thread or target data segment, the target thread or target data segment has degraded access; the third determination module 1404 is used to determine the target association domain corresponding to the tuning object based on the ownership relationship between the thread and the data segment, the target association domain includes the tuning object, and the threads and data segments related to the tuning object; the fourth determination module 1405 is used to determine the scheduling decision of each thread in the association domain and the migration decision of each data segment; the sending module 1406 is used to send the scheduling decision of each thread to the first node where each thread is located, so that the first node schedules the thread task based on the received scheduling decision, and send the migration strategy of each data segment to the second node where each data segment is located, so that the second node migrates the data segment based on the received migration strategy.
[0190] In a possible implementation, the acquisition module 1401 is specifically used to: receive sampling data sent by a hardware sampler deployed on each of the multiple nodes, where the sampling data includes memory access information of a memory access instruction.
[0191] In another possible implementation, when the sampled data collected by the hardware sampler reaches a preset size, the hardware sampler sends the collected sampled data to the management node.
[0192] Optionally, the hardware sampler is SPE or PEBS.
[0193] In another possible implementation, the memory access information of the memory access instruction includes the execution time of the memory access instruction, the memory access address, and the thread to which the memory access instruction belongs; the first determination module 1402 is specifically used to determine the ownership relationship between the current thread and the data segment based on the execution time of the memory access instruction, the memory access address, and the thread to which the memory access instruction belongs.
[0194] In another possible implementation, a specific implementation of determining the ownership relationship between the current thread and the data segment based on the execution time of the memory access instruction, the memory access address, and the thread to which the memory access instruction belongs is: based on the execution time of the memory access instruction, the memory access address, and the thread to which the memory access instruction belongs, determining a number of data pages that each current thread task has ownership of; and aggregating the several data pages to determine the data segment that each thread task has ownership of.
[0195] In another possible implementation, a number of data pages are aggregated to determine a data segment that each thread has ownership of. A specific implementation is: obtain a number of valid data pages from a number of data pages that each thread has ownership of, where a valid data page has an access frequency greater than a first preset threshold; aggregate the valid data pages whose virtual address distance is less than a second preset threshold among the number of valid data pages to obtain a data segment that each thread has ownership of.
[0196] In another possible implementation, the ownership relationship between the thread and the data segment is determined based on ownership relationship marking information, where the ownership relationship marking information marks the data segment that each thread in each node among multiple nodes has ownership; the ownership relationship marking information is obtained based on data application operations of each thread task captured at runtime; or, the ownership relationship marking information is obtained based on information input by a user.
[0197] In one example, the ownership relationship between a thread and a data segment is determined and recorded in a mapping table in a bidirectional index structure; the mapping table includes a thread index and a data index, the thread index is used to find a data segment owned by a thread task through a thread, and the data index is used to find a thread task to which a data segment belongs through a data segment.
[0198] In another possible implementation, the mapping table further records one or more of the node where each thread is located, the node where the data segment is located, and the access frequency of the data segment to which each thread has ownership.
[0199] In another possible implementation, the memory access information of the memory access instruction also includes one or more of the CPU running node corresponding to the memory access instruction, the memory access delay, and the memory access read and write type; the second determination module is specifically used to: determine the data profile between each thread and the data segment to which it owns based on the ownership relationship between the thread and the data segment and the memory access information of the memory access instruction, the data profile depicts the memory access characteristics of the data segment to which each thread task owns; based on the data profile, determine the tuning object.
[0200] Optionally, the memory access feature includes one or more of a historical memory access pattern, a memory access ratio within a node or between nodes, a memory access heat, and a memory access delay.
[0201] In another possible implementation, the task and data management device 1400 provided in the present application also includes a display module 1407, which is used to display the data portrait for the convenience of users or tuning experts to view, and further analysis can be performed through the data portrait to supplement some thread scheduling decisions or data migration decisions.
[0202] In an example, the degraded access condition includes one or more of remote access, access delay greater than a third preset threshold, and bandwidth occupancy greater than a fourth preset threshold.
[0203] In another possible implementation, the third determination module 1404 is specifically used to: determine a thread or data segment that has an ownership relationship with the tuning object as a first associated object; determine a thread or data segment that has an ownership relationship with the first object as a second associated object; after several calculation iterations, obtain N associated objects, N is a positive integer; based on the tuning object and the N associated objects, determine the target associated domain corresponding to the tuning object.
[0204] In another possible implementation, determination of the associated object is also related to a propagation threshold. When the access frequency between a thread or a data segment and an object in a target associated domain is greater than or equal to the propagation threshold, the thread task or the data segment is determined as an associated object.
[0205] Optionally, the number of calculation iterations is a preset number.
[0206] In another possible implementation, the fourth determination module 1405 is specifically used to: calculate the scores of multiple scheduling decisions for each thread in the association domain, multiple scheduling strategies indicate that each thread is scheduled from the current node to other associated nodes, the associated node is the node where the thread or data segment in the target association domain is located, and the score of the scheduling decision is used to evaluate the access performance of each thread to the data segment to which it has ownership relationship after the scheduling decision is executed; use the scheduling decision with the highest score among the multiple scheduling decisions as the scheduling decision for each thread in the association domain; calculate the scores of multiple migration decisions for each data segment in the association domain, multiple migration strategies indicate that each data segment is migrated from the current node to other associated nodes, and the score of the migration decision is used to evaluate the access performance of each data segment by the thread to which it belongs after the migration decision is executed; use the migration decision with the highest score among the multiple migration decisions as the migration decision for each data segment in the association domain.
[0207] In one example, the score of the scheduling decision is determined based on the access delay optimization amount and the scheduling cost after the thread is scheduled; the score of the migration decision is determined based on the access delay optimization amount and the migration cost after the data segment is migrated.
[0208] In another possible implementation, the task and data management device 1400 provided in the present application also includes a detection module 1408, which is used to determine whether the scheduling decisions of each thread and the migration decisions of each data segment meet the executable conditions; and discard the scheduling decisions and migration decisions that do not meet the executable conditions.
[0209] In another possible implementation, the executable conditions include one or more of the following: the memory space of the target node corresponding to the scheduling decisions of each thread and the migration decisions of each data segment is met, and the bandwidth between the current node and the target node corresponding to the scheduling decisions of each thread and the migration decisions of each data segment is met.
[0210] In another possible implementation, the sending module 1406 is specifically used to: send the scheduling decision of each thread as prompt information to the thread scheduler in the first node where each thread is located, the prompt information is used as an influencing factor for the thread scheduler to determine the thread scheduling policy, and the thread scheduler is used to schedule the threads according to the thread scheduling policy; send the migration strategy of each data segment to the second node where each data segment is located, so that the second node migrates the data segment based on the received migration strategy. A specific implementation is: send the migration strategy of each data segment to the data migration queue in the second node where each data segment is located, so that the second node executes the migration instruction in the data migration queue to migrate each data segment from the current node to the target node.
[0211] Optionally, the architecture of the computer system mentioned above may be a NUMA architecture, and the multiple nodes are multiple NUMA nodes; or the computer system includes multiple Hosts, and the multiple nodes are multiple Host nodes.
[0212] The task and data management device 1400 according to the embodiment of the present application may correspond to the method described in the embodiment of the present application, and the above and other operations and / or functions of each module in the task and data management device 1400 are respectively to implement Figure 6-13 For the sake of brevity, the corresponding processes of each method in are not repeated here.
[0213] The present application also provides a computing device, including at least one processor, a memory and a communication interface, wherein the processor is used to execute Figure 6-13 The method described.
[0214] Fig.15 A schematic diagram of the structure of a computing device provided in an embodiment of the present application.
[0215] like Fig.15As shown, the computing device 1500 includes at least one processor 1501, a memory 1502 and a communication interface 1503. The processor 1501, the memory 1502 and the communication interface 1503 are communicatively connected, and the communication connection can be realized by wired means (such as a bus) or by wireless means. The communication interface 1503 is used to send and / or receive data sent by other devices; the memory 1502 stores computer instructions, and the processor 1501 executes the computer instructions to execute the task and data management method in the aforementioned method embodiment, so as to realize active tuning of threads / data with degraded access, reduce remote access, and improve the overall performance of the system.
[0216] It should be understood that in the embodiment of the present application, the processor 1501 may be a central processing unit CPU, and the processor 1501 may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0217] The memory 1502 may include a read-only memory and a random access memory, and provides instructions and data to the processor 1501. The memory 1502 may also include a nonvolatile random access memory.
[0218] The memory 1502 may be a volatile memory or a nonvolatile memory, or may include both volatile and nonvolatile memories. Among them, the nonvolatile memory may be a read-only memory (ROM), a programmable ROM (PROM), an erasable programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM).
[0219] It should be understood that the computing device 1500 according to the embodiment of the present application can execute the implementation of the embodiment of the present application. Figure 6-13 The method shown, the detailed description of the implementation of this method can be found above, for the sake of brevity, it will not be repeated here.
[0220] An embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the above-mentioned method is implemented.
[0221] An embodiment of the present application provides a chip, which includes at least one processor and an interface, wherein the at least one processor determines program instructions or data through the interface; the at least one processor is used to execute the program instructions to implement the method mentioned above.
[0222] An embodiment of the present application provides a computer program or a computer program product, wherein the computer program or the computer program product comprises instructions, and when the instructions are executed, the computer is caused to execute the above-mentioned method.
[0223] Those of ordinary skill in the art should further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those of ordinary skill in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0224] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented by hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0225] The specific implementation methods described above further illustrate the purpose, technical solutions and beneficial effects of the present application in detail. It should be understood that the above description is only the specific implementation method of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application.
Claims
1. A task and data management method, characterized in that: Applied to a computer system, the computer system includes a plurality of nodes, the plurality of nodes includes a management node, the method is executed by the management node, and the method includes: Acquire memory access information of a memory access instruction in each of the plurality of nodes; Determining an ownership relationship between thread tasks and data segments, the ownership relationship indicating a data segment owned by each thread task in each of the plurality of nodes, and a thread task to which each data segment in each of the plurality of nodes belongs; Determine a tuning object based on the memory access information of the memory access instruction, wherein the tuning object includes a target thread task or a target data segment, and a degraded access situation exists in the target thread task or the target data segment; Based on the ownership relationship between the thread tasks and the data segments, determining a target association domain corresponding to the tuning object, the target association domain including the tuning object, and the thread tasks and data segments related to the tuning object; Determine the scheduling decision of each thread task and the migration decision of each data segment in the association domain; The scheduling decisions of the respective thread tasks are sent to the first node where the respective thread tasks are located, so that the first node schedules the thread tasks based on the received scheduling decisions; and the migration strategies of the respective data segments are sent to the second node where the respective data segments are located, so that the second node migrates the data segments based on the received migration strategies.
2. The method according to claim 1, characterized in that The acquiring memory access information of the memory access instruction in each of the multiple nodes includes: Receive sampling data sent by a hardware sampler deployed on each of the multiple nodes, where the sampling data includes memory access information of the memory access instruction.
3. The method according to claim 2, characterized in that When the sampling data collected by the hardware sampler reaches a preset size, the hardware sampler sends the collected sampling data to the management node.
4. The method according to claim 2 or 3, characterized in that: The hardware sampler is a statistical analysis extension sampler or a processor event sampler.
5. The method according to any one of claims 1 to 4, characterized in that: The memory access information of the memory access instruction includes the execution time of the memory access instruction, the memory access address, and the thread task to which the memory access instruction belongs; Determining the ownership relationship between the thread task and the data segment includes: Based on the execution time of the memory access instruction, the memory access address, and the thread task to which the memory access instruction belongs, the ownership relationship between the current thread task and the data segment is determined.
6. The method according to claim 5, characterized in that The determining the ownership relationship between the current thread task and the data segment based on the execution time of the memory access instruction, the memory access address, and the thread task to which the memory access instruction belongs includes: Based on the execution time of the memory access instruction, the memory access address and the thread task to which the memory access instruction belongs, determining a number of data pages owned by each current thread task; The plurality of data pages are aggregated to determine data segments owned by each thread task.
7. The method according to claim 6, characterized in that The step of aggregating the plurality of data pages to determine data segments owned by each thread task includes: Acquire a number of valid data pages among a number of data pages owned by each of the thread tasks, wherein the valid data pages are data pages whose access frequency is greater than a first preset threshold; Valid data pages whose virtual address distances are less than a second preset threshold value among the plurality of valid data pages are aggregated to obtain data segments owned by each thread task.
8. The method according to any one of claims 1 to 7, characterized in that: The ownership relationship between the thread task and the data segment is determined based on ownership relationship marking information, wherein the ownership relationship marking information marks the data segment that each thread task in each node of the plurality of nodes has ownership; The ownership relationship tag information is obtained based on the data application operation of each thread task captured during runtime; Alternatively, the ownership relationship mark information is obtained based on information input by the user.
9. The method according to any one of claims 1 to 8, characterized in that: The ownership relationship between the determined thread task and the data segment is recorded in a mapping table in a bidirectional index structure; The mapping table includes a thread index and a data index. The thread index is used to find a data segment owned by the thread task through a thread task, and the data index is used to find a thread task to which the data segment belongs through a data segment.
10. The method according to claim 9, characterized in that The mapping table also records one or more of the nodes where the various thread tasks are located, the nodes where the data segments are located, and the access frequencies of the data segments to which the various thread tasks have ownership.
11. The method according to any one of claims 5 to 10, characterized in that: The memory access information of the memory access instruction also includes one or more of the CPU running node, memory access delay, and memory access read / write type corresponding to the memory access instruction; The determining of the tuning object based on the memory access information of the memory access instruction includes: Based on the ownership relationship between the thread task and the data segment and the memory access information of the memory access instruction, determine a data profile between each thread task and the data segment owned by it, wherein the data profile describes the memory access characteristics of the data segment owned by each thread task; Based on the data profile, the tuning object is determined.
12. The method according to claim 11, characterized in that The memory access characteristics include one or more of historical memory access patterns, memory access ratios within a node or between nodes, memory access heat, and memory access delay.
13. The method according to claim 11 or 12, characterized in that: Also includes: The data image is displayed.
14. The method according to any one of claims 1 to 13, characterized in that: The degraded access condition includes one or more of remote access, access delay greater than a third preset threshold, and bandwidth occupancy greater than a fourth preset threshold.
15. The method according to any one of claims 1 to 14, characterized in that: The determining, based on the ownership relationship between the thread task and the data segment, a target association domain corresponding to the tuning object includes: Determine a thread task or a data segment having an ownership relationship with the tuning object as a first associated object; Determine a thread task or a data segment having an ownership relationship with the first object as a second associated object; After several calculation iterations, N associated objects are obtained, where N is a positive integer; Based on the tuning object and the N associated objects, a target associated domain corresponding to the tuning object is determined.
16. The method according to claim 15, characterized in that The determination of the associated object is also related to a propagation threshold. When the access frequency between a thread task or a data segment and an object in the target associated domain is greater than or equal to the propagation threshold, the thread task or the data segment is determined as the associated object.
17. The method according to claim 15 or 16, characterized in that The number of calculation iterations is a preset number.
18. The method according to any one of claims 1 to 17, characterized in that: The determining of the scheduling decision of each thread task and the migration decision of each data segment in the association domain includes: Calculating scores of multiple scheduling decisions of each thread task in the association domain, wherein the multiple scheduling strategies indicate that each thread task is scheduled from a current node to another association node, wherein the association node is a thread task in the target association domain or a node where the data segment is located, and the scores of the scheduling decisions are used to evaluate access performance of each thread task to the data segment with which it has ownership relationship after the scheduling decisions are executed; Using the scheduling decision with the highest score among the multiple scheduling decisions as the scheduling decision for each thread task in the associated domain; Calculating scores of multiple migration decisions for each data segment in the associated domain, wherein the multiple migration strategies indicate that each data segment is migrated from a current node to another associated node, and the scores of the migration decisions are used to evaluate access performance of each data segment after the migration decision is executed when the data segment is accessed by the thread task to which it belongs; The migration decision with the highest score among the multiple migration decisions is used as the migration decision for each data segment in the associated domain.
19. The method according to claim 18, characterized in that The score of the scheduling decision is determined based on the access delay optimization amount and the scheduling cost of the thread task after being scheduled; The score of the migration decision is determined based on the access latency optimization amount and the migration cost of the data segment after the data segment is migrated.
20. The method according to any one of claims 1 to 19, characterized in that: Also includes: Determine whether the scheduling decision of each thread task and the migration decision of each data segment meet the executable conditions; The scheduling decisions and migration decisions that do not meet the executable conditions are discarded.
21. The method according to claim 20, characterized in that The executable conditions include one or more of the following: the memory space of the target node corresponding to the scheduling decisions of the various thread tasks and the migration decisions of the various data segments meets the requirements; and the bandwidth between the current node and the target node corresponding to the scheduling decisions of the various thread tasks and the migration decisions of the various data segments meets the requirements.
22. The method according to any one of claims 1 to 21, characterized in that: The sending the scheduling decisions of the respective thread tasks to the first node where the respective thread tasks are located, so that the first node schedules the thread tasks based on the received scheduling decisions, comprises: Sending the scheduling decision of each thread task as prompt information to the thread scheduler in the first node where each thread task is located, wherein the prompt information is used as an influencing factor for the thread scheduler to determine a thread scheduling strategy, and the thread scheduler is used to schedule the thread tasks according to the thread scheduling strategy; The step of sending the migration strategy of each data segment to the second node where each data segment is located, so that the second node migrates the data segment based on the received migration strategy, includes: The migration strategy of each data segment is sent to the data migration queue in the second node where each data segment is located, so that the second node executes the migration instruction in the data migration queue to migrate each data segment from the current node to the target node.
23. The method according to any one of claims 1 to 22, characterized in that: The architecture of the computer system is a NUMA architecture, and the multiple nodes are multiple NUMA nodes.
24. A task and data management device, characterized in that: Applied to a computer system, the computer system includes a plurality of nodes, the plurality of nodes include a management node, the device is deployed on the management node, and the device includes: An acquisition module, used for acquiring memory access information of a memory access instruction in each of the plurality of nodes; A first determination module is used to determine an ownership relationship between a thread task and a data segment, wherein the ownership relationship indicates a data segment owned by each thread task in each node of the plurality of nodes, and a thread task to which each data segment in each node of the plurality of nodes belongs; A second determination module is used to determine a tuning object based on the memory access information of the memory access instruction, wherein the tuning object includes a target thread task or a target data segment, and a degraded access situation exists in the target thread task or the target data segment; A third determination module is used to determine a target association domain corresponding to the tuning object based on the ownership relationship between the thread task and the data segment, wherein the target association domain includes the tuning object and the thread task and the data segment related to the tuning object; A fourth determination module, used to determine a scheduling decision for each thread task and a migration decision for each data segment in the association domain; A sending module is used to send the scheduling decision of each thread task to the first node where each thread task is located, so that the first node schedules the thread task based on the received scheduling decision, and to send the migration strategy of each data segment to the second node where each data segment is located, so that the second node migrates the data segment based on the received migration strategy.
25. A computing device comprising a memory and a processor, characterized in that: Instructions are stored in the memory, and when the instructions are executed by the processor, the method according to any one of claims 1 to 23 is implemented.
26. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 23 is implemented.
Citation Information
Cited By
Data communication method and device, electronic equipment and storage medium
CN121509528A