Data processing method and related equipment
By counting the number of access failures of multi-core processors and meeting preset rules for page table migration, it solves the problem of high page table migration overhead under the NUMA architecture, improves memory response speed and protects process performance.
Patent Information
- Application Number
- CN202310361989.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-31
- Publication Date
- 2024-10-01
AI Technical Summary
Under the non-uniform memory access (NUMA) architecture, the response speed of the processor core decreases when accessing non-local memory. The existing automatic NUMA balancing algorithm needs to scan the page table, resulting in high overhead and possibly affecting the performance of memory-sensitive processes.
By collecting specified data in access failure events, the number of failed accesses to the page table of each multi-core processor is counted. If the preset migration rules are met, the page table migration is performed without scanning the page table, avoiding modification of page table permissions, reducing overhead and Protect process performance.
It achieves efficient page table migration without affecting process performance, improves memory response speed, and reduces data processing overhead.
Smart Images

Figure CN118733491A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data processing method and related equipment. Background Art
[0002] In the scenario where the number of processor cores is increasing rapidly, in order to improve the memory response speed, hardware architects evenly distribute the memory on each die so that each core has its own local access. However, in the non-uniform memory access (NUMA) architecture, when the core in the processor needs to access non-locally connected memory, it needs to go through the internal connection channel of the bus architecture, and its response speed is greatly reduced.
[0003] To this end, the Linux kernel provides an automatic NUMA balancing algorithm to solve the above problems. The automatic NUMA balancing algorithm can migrate data (pages) to the memory directly connected to the process according to different page attribute items to improve the response speed.
[0004] Specifically, to determine whether a process needs to be switched, the LINUX kernel can add NUMA balance to the timer by calling task_tick_NUMA. When the timer ends, NUMA balance is triggered. NUMAbalance can scan the virtual address area of the process and modify the read and write permissions of the page table entry (PTE) table corresponding to the page table in the virtual address area to PAGE_NONE. Then, when the address corresponding to the page table is accessed next time, a page-fault will be generated because the read and write permissions of its PTE table are PAGE_NONE. After obtaining statistical results by counting the generated page-faults and the corresponding page tables, the Automatic NUMABalancing algorithm can be executed based on the statistical results. The Automatic NUMA Balancing algorithm determines whether to migrate the page table based on the statistical results.
[0005] However, the above method needs to scan the page table, which has a large overhead. In addition, the current algorithm mechanism changes the read and write permissions of the PTE table corresponding to the page table to PTE_NONE to trigger a page-fault, which will affect the performance of the process when the process is memory-sensitive. Summary of the invention
[0006] The embodiments of the present application provide a data processing method and related devices for migrating a page table.
[0007] In the first aspect of the present application, a data processing method is proposed for a multi-core processor, wherein the multi-core processor includes a first core and a second core, wherein the first core belongs to a first non-uniform memory access NUMA node, and the second core belongs to a second NUME node, wherein the first NUMA node corresponds to a first memory, and the second NUMA corresponds to a second memory. In the present application, when a first access failure event occurs, the first designated data corresponding to the first access failure event is collected, wherein the first designated data includes a first address, an identifier of a first process, and an identifier of a second core, and the access failure event is used to indicate that the second core fails to access the first page table, wherein the first page table belongs to the first process, and the first page table corresponds to a first address, and the first address belongs to the first memory. Then, data statistics are performed on a plurality of designated data to obtain statistical data, wherein the plurality of designated data includes the first designated data, and the statistical data includes the number of failed accesses to the first page table by each core in the multi-core processor. If the statistical data meets the preset migration rule, the first page table is migrated to the second memory. The method does not need to scan the page table, which greatly reduces the overhead. Moreover, there is no need to modify the permissions of the page table to PTE_NONE, which will not affect the performance of the process to which the page table belongs.
[0008] In some possible implementations, the serial-to-parallel extension SPE option is turned on, and a run command is issued to the SPE hardware based on the SPE option. The run command is used to instruct the SPE hardware to collect the first specified data corresponding to the first access failure event when the first access failure event occurs, thereby achieving the collection of the first specified data corresponding to the first access failure event by the SPE hardware.
[0009] In some possible implementations, the statistical data include dst_page_faults and src_page_faults, wherein the dst_page_faults is the number of failed accesses of the second core to the first page table, and the src_page_faults is the number of failed accesses of the first core to the first page table, thereby performing data statistics to obtain statistical data for determining whether to migrate the first page table to the second memory.
[0010] In some possible implementations, the migration rule includes: the second core fails to access the first page table or fails to access it continuously for P times or more, and the ratio of the src_page_faults to the dst_page_faults is less than a preset ratio, and P is a positive integer greater than or equal to 2; or, the dst_page_faults is M times the src_page_faults, and M is a positive integer. Then, it can be determined whether to migrate the first page table to the second memory based on the migration rule.
[0011] In some possible implementations, the statistical data decays by half in the next data statistical cycle, so that more recent statistical data has a greater weight when determining whether to migrate the first page table to the second memory.
[0012] In some possible implementations, the correspondence between the first page table and the first address is unbound, and the first page table and the second address are bound, so that the first page table corresponds to the second address, and the second address belongs to the second memory, thereby realizing the migration of the first page table to the second memory.
[0013] In some possible implementations, the statistical data also includes a total number of failed accesses by the CPU to the first page table. Displaying the total number of failed accesses intuitively displays the popularity of the first page table to the user.
[0014] A second aspect of the present application provides a computing device, which is used to execute any one of the methods described in the first aspect.
[0015] A third aspect of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute any of the methods in the first, second, or third aspects above.
[0016] A fourth aspect of the present application provides a computer program product, which includes computer execution instructions, which are stored in a computer-readable storage medium; at least one processor of a device can read the computer execution instructions from the computer-readable storage medium, and at least one processor executes the computer execution instructions so that the device implements the method provided by the above-mentioned first aspect or any possible implementation of the first aspect.
[0017] In a fifth aspect, the present application provides a communication device, which may include at least one processor, a memory, and a communication interface. At least one processor is coupled to the memory and the communication interface. The memory is used to store instructions, at least one processor is used to execute the instructions, and the communication interface is used to communicate with other communication devices under the control of at least one processor. When the instructions are executed by at least one processor, the at least one processor executes the method in the first aspect or any possible implementation of the first aspect.
[0018] A sixth aspect of the present application provides a chip system, which includes a processor for supporting the implementation of the functions involved in the above-mentioned first aspect or any possible implementation method of the first aspect.
[0019] In a possible design, the chip system may also include a memory, which is used to store necessary program instructions and data. The chip system may be composed of a chip, or may include a chip and other discrete devices.
[0020] Among them, the technical effects brought about by the second to sixth aspects or any possible implementation methods thereof can refer to the technical effects brought about by the first aspect or different possible implementation methods of the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1-1 A schematic diagram of the hardware structure of a computing device provided in an embodiment of the present application;
[0022] Figure 1-2 A schematic diagram of a NUMA architecture provided in an embodiment of the present application;
[0023] Figure 2-1 A flowchart of a data processing method provided in an embodiment of the present application;
[0024] Figure 2-2 A schematic diagram of an operation command provided in an embodiment of the present application;
[0025] Figure 2-3 A schematic diagram of page table migration provided in an embodiment of the present application;
[0026] Figure 3 A schematic diagram of the structure of a computing device provided in an embodiment of the present application;
[0027] Figure 4 A schematic diagram of the structure of a communication device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0028] The embodiments of the present application provide a data processing method and related devices for migrating a page table.
[0029] The embodiments of the present application are described below in conjunction with the accompanying drawings.
[0030] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0031] like Figure 1-1 As shown, it is a schematic diagram of the hardware structure of a computing device provided in an embodiment of the present application. The hardware structure 100 of the computing device may include components such as a processor 110, a memory 120, a network interface 130 (also known as a network card or network adapter, etc.), and a bus 140.
[0032] Among them, the processor 110 is a multi-core processor, and the types of processors include a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor or a coprocessor. The memory 120 includes a volatile memory and a non-volatile memory, wherein the volatile memory is usually used as a temporary storage medium for an operating system or other running programs, and the non-volatile memory is usually used to store an operating system and operating instructions, executable modules or data structures, or a subset thereof, or an extended set thereof, wherein the operating instructions may include various operating instructions for implementing various operations. The operating system may include various system programs for implementing various basic services and processing hardware-based tasks. The network interface 130 can be used to connect other network devices, including wireless connections and wired connections. The above components are connected via a bus 140. The bus 140 can be one or more. The bus 140 includes an advanced microcontroller bus architecture (AMBA) industry standard architecture (ISA) bus, a micro channel architecture (MCA) bus, an extended-ISA bus, a video electronics standard sassociation (VESA) local bus, and a peripheral component interconnect (PCI) bus, etc.
[0033] In some possible implementations, the computing device may be a server. A server, also known as a server, is a device that provides computing services. Since a server needs to respond to service requests and process them to provide reliable services, generally speaking, a server should have the ability to undertake and guarantee services. The server needs to have strong processing power, high stability, high reliability, high security, scalability, and manageability.
[0034] The server may vary greatly in configuration or performance, and may include at least one central processing unit (CPU) (e.g., at least one processor) and at least one storage medium (e.g., at least one mass storage device) storing applications or data. Furthermore, the CPU may be configured to communicate with the storage medium and execute a series of instructions in the storage medium on the server. The server may also include at least one power supply, at least one wired or wireless network interface, at least one input and output interface, and / or at least one operating system, such as Linux.
[0035] CPU is an integrated circuit chip with signal processing capabilities. CPU can be a general-purpose processor based on advanced reduced instruction set machine (ARM), digital signal processing (DSP), application specific integrated circuit (ASIC), field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to be executed, or a combination of hardware and software modules in the decoding processor to be executed. The software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers, etc.
[0036] In the scenario where the number of cores of the processor 110 is increasing rapidly, in order to improve the response speed of the memory 120, the hardware architect evenly distributes the memory 120 on each die through the non-uniform memory access (NUMA) architecture, so that each core has its own local access. The NUMA architecture is a memory body design for multi-core processors. Under NUMA, a core accesses its own local memory faster than non-local memory.
[0037] See also Figure 1-2 , shows a schematic diagram of a NUMA architecture. For example, Figure 1-2 As shown, the NUMA architecture 100 includes four NUMA nodes, namely NUMA node 0, NUMA node 1, NUMA node 2 and NUMA node 3.
[0038] Each NUMA node may include multiple cores. In the embodiment of the present application, 32 cores are used as an example for explanation. Figure 1-2 As shown, NUMA node 0 contains 32 cores including core 0, core 1, ..., core 31, NUMA node 1 contains 32 cores including core 32, core 33, ..., core 63, NUMA node 2 contains 32 cores including core 64, core 65, ..., core 95, and NUMA node 3 contains 32 cores including core 96, core 97, ..., core 127.
[0039] At the same time, each NUMA node is configured with corresponding memory, for example, NUMA node 0 can be configured with memory 0, NUMA node 1 can be configured with memory 1, NUMA node 2 can be configured with memory 2, and NUMA node 3 can be configured with memory 3. The size of memory 0 to 3 can be 4*32G, etc., which is not limited here.
[0040] exist Figure 1-2 In the NUMA architecture shown, NUMA node 0 can be called the local node (localnode) of cores 0 to 31, and NUMA node 1, NUMA node 2, and NUMA node 3, which are not local nodes, can be called remote nodes (remote nodes) of cores 32 to 63; NUMA node 1 can be called the local node (local node) of cores 32 to 63, and NUMA node 0, NUMA node 2, and NUMA node 3, which are not local nodes, can be called remote nodes (remote nodes) of cores 32 to 63; NUMA node 2 can be called the local node (local node) of cores 64 to 95, and NUMA node 0, NUMA node 1, and NUMA node 3, which are not local nodes, can be called remote nodes (remote nodes) of cores 64 to 95; NUMA node 3 can be called the local node (local node) of cores 96 to 127, and NUMA node 0, NUMA node 1, and NUMA node 2, which are not local nodes, can be called remote nodes (remote nodes) of cores 96 to 127.
[0041] The speed at which a local node accesses the memory corresponding to different NUMA nodes is usually different. For example, when NUMA node 0 accesses memory 0, the access speed is faster, and when accessing memory 1 to 3 of a remote node, the access speed is slower.
[0042] In the scenario where the number of processor cores is increasing rapidly, in order to improve the memory response speed, hardware architects evenly distribute the memory on each die so that each core has its own local access. However, in the non-uniform memory access (NUMA) architecture, when the core in the processor needs to access non-locally connected memory, it needs to go through the internal connection channel of the bus architecture, and its response speed is greatly reduced.
[0043] To this end, the Linux kernel provides an automatic NUMA balancing algorithm to solve the above problems. The automatic NUMA balancing algorithm can migrate data (pages) to the memory directly connected to the process according to different page attribute items to improve the response speed.
[0044] Specifically, to determine whether a process needs to be switched, the LINUX kernel can add NUMA balance to the timer by calling task_tick_NUMA. When the timer ends, NUMA balance is triggered. NUMAbalance can scan the virtual address area of the process and modify the read and write permissions of the page table entry (PTE) table corresponding to the page table in the virtual address area to PAGE_NONE. Then, when the address corresponding to the page table is accessed next time, a page-fault will be generated because the read and write permissions of its PTE table are PAGE_NONE. After obtaining statistical results by counting the generated page-faults and the corresponding page tables, the Automatic NUMABalancing algorithm can be executed based on the statistical results. The Automatic NUMA Balancing algorithm determines whether to migrate the page table based on the statistical results.
[0045] However, the above method needs to scan the page table, which has a large overhead. In addition, the current algorithm mechanism changes the read and write permissions of the PTE table corresponding to the page table to PTE_NONE to trigger a page-fault, which will affect the performance of the process when the process is memory-sensitive.
[0046] To this end, the present application proposes a data processing method for a multi-core processor, the multi-core processor includes a first core and a second core, the first core belongs to a first non-uniform memory access NUMA node, the second core belongs to a second NUME node, the first NUMA node corresponds to a first memory, and the second NUMA corresponds to a second memory. In the present application, when a first access failure event occurs, the first designated data corresponding to the first access failure event is collected, the first designated data includes a first address, an identifier of a first process, and an identifier of a second core, the access failure event is used to indicate that the second core fails to access the first page table, the first page table belongs to the first process, the first page table corresponds to a first address, and the first address belongs to the first memory. Then, data statistics are performed on multiple copies of designated data to obtain statistical data, the multiple copies of designated data include the first designated data, and the statistical data include the number of failed accesses to the first page table by each core in the multi-core processor. If the statistical data meets the preset migration rule, the first page table is migrated to the second memory. This method does not require scanning the page table, which greatly reduces the overhead. In addition, there is no need to modify the permissions of the page table to PTE_NONE, which will not affect the performance of the process to which the page table belongs.
[0047] See also Figure 2-1 As shown, an embodiment of the present application provides a data processing method for a multi-core processor, wherein the multi-core processor includes a first core and a second core, the first core belongs to a first NUMA node, the second core belongs to a second NUMA node, the first NUMA node corresponds to a first memory, and the second NUMA corresponds to a second memory.
[0048] The data processing mainly includes the following steps:
[0049] 201. The user state sends a run command to the SPE hardware based on a serial parallel expansion (SPE) option, where the run command is used to instruct the SPE hardware to collect first designated data corresponding to the first access failure event when a first access failure event occurs.
[0050] The user state sends a run command to the hardware, where the run command is used to instruct data sampling to obtain specified data.
[0051] In some possible implementations, a user may operate on a computing device to cause the computing device to enter a basic input output system (BIOS) interface, and then turn on the SPE option in the BIOS interface. The SPE option is implemented based on SPE hardware, which is an extension hardware connected to the CPU. The SPE hardware can receive a run command input from a user state and execute the run command.
[0052] It should be noted that user state can be called user state software. User state is developed based on the Linux kernel and provides an interface for users to operate on computing devices. User state can call functions of the Linux kernel and can interact with SPE hardware for signaling and data. It should be noted that the run command is developed by the developer in the user state. When the SPE option is entered, the user state can automatically send the run command to the SPE hardware based on the developed program code.
[0053] For example, Figure 2-2 As shown in FIG. 1 , a running command input to the SPE option in the user state running on the Linux kernel is shown. The name of the running command is “perf_event_attr”. “perf_event_attr” is used to instruct the SPE hardware to sample the specified data and return it to the Linux kernel when a specified event occurs.
[0054] The perf_event_attr may include the following:
[0055] Type, which indicates the command type of "perf_event_attr" in the Linux kernel. "65" indicates the command type number of "perf_event_attr";
[0056] Size: indicates the data size of the "perf_event_attr". "112" indicates that the data size is 112 bytes.
[0057] Configuration (Config), indicating the specified event indicated by the "perf_event_attr", whose value is the identifier of the specified event, wherein the specified event corresponding to "0x600010003" is the "last level cache_miss (llc_miss) event";
[0058] In {Sample_period, sample_freq}, "Sample_period" indicates the sampling period, and "Sample_freq" indicates the sampling frequency;
[0059] Sample type (Sample_type) indicates the sample type of the specified data to be sampled. For example, "IP" indicates the address (addr) of the specified data, "TID" indicates the thread ID (TID) and also indicates the process ID (PID), "time" indicates the timestamp when the specified data is sampled, "CPU" indicates the ID of the core of the specified data, and "IDENTIFIER" indicates the total ID of the specified data sampled this time.
[0060] In addition, "perf_event_attr" can also include "Disabled", "Inherit", "Sample_id_all", "Exclude_guest" and other contents, which are not described here.
[0061] 202. When a first access failure event occurs, the SPE hardware collects first designated data corresponding to the first access failure event, where the first designated data includes a first address, an identifier of a first process, and an identifier of a second core. The access failure event is used to indicate that the second core fails to access a first page table, the first page table belongs to the first process, the first page table corresponds to a first address, and the first address belongs to a first memory.
[0062] Continuing with the above example, when the SPE hardware receives the run command "perf_event_attr", the SPE hardware can monitor whether the specified event "last level cache miss (last level cache_miss, llc_miss) event" corresponding to "0x600010003" in the configuration (Config) occurs based on the run command "perf_event_attr". If the specified event "last level cache miss (last level cache_miss, llc_miss) event" occurs, the first specified data indicated in the sample type (Sample_type) is collected, and the first specified data includes a first address, an identifier of a first process, and an identifier of a second core. The access failure event is used to indicate that the second core fails to access the first page table, the first page table belongs to the first process, the first page table corresponds to a first address, and the first address belongs to the first memory.
[0063] Exemplarily, when core 0 in NUMA node 0 accesses address 1 in memory 0 as a local node, if the read fails, that is, a "last level cache miss (last level cache_miss, llc_miss) event" is generated, that is, the first access failure event, then the SPE hardware can collect the first specified data indicated by the sample type (Sample_type) in "perf_event_attr", including IP (first address), TID (identifier of the first process), time, CPU (identifier of the second core) and IDENTIFIER, as well as other information. Among them, IP can be represented as address 1 (which can be recorded as IP1), TID represents thread 1 of address 1 in core 0 (recorded as TID1), time represents the timestamp of the occurrence of the "last level cache miss (last level cache_miss, llc_miss) event" (recorded as time1), CPU represents the identifier of core 0 (recorded as CPUID1), and IDENTIFIER represents the identifier of a column or a table formed by the information returned this time (recorded as IDENTIFIER1). Exemplarily, the designated data 1 obtained by the SPE hardware based on the running command collection is IP1, TID1, time1, CPUID1, and IDENTIFIER1.
[0064] As another example, when core 32 in NUMA node 1 accesses address 2 in memory 2 as a remote node, if the read fails, that is, a "last level cache miss (llc_miss) event" is generated, that is, a first access failure event, then the SPE hardware can collect the first specified data indicated by the sample type (Sample_type) in "perf_event_attr", including IP (first address), TID (identifier of the first process), time, CPU (identifier of the second core) and IDENTIFIER, as well as other information. Among them, IP can be represented as the address 2 (represented as IP2), TID represents the thread 2 of the address 2 in core 32 (represented as TID2), time represents the timestamp of the occurrence of the "last level cache miss (llc_miss) event" (represented as time2), CPU represents the identifier of core 32 (represented as CPUID2), and IDENTIFIER represents the identifier of a column or a table formed by the information returned this time (represented as IDENTIFIER2). Exemplarily, the designated data 2 obtained by the SPE hardware based on the running command collection are IP2, TID2, time2, CPUID2, and IDENTIFIER2.
[0065] 203. The SPE hardware returns the first specified data to the user state.
[0066] In an embodiment of the present application, when the SPE hardware collects the specified data based on the running command, the first specified data obtained by the collection can be sent to the user state. Exemplarily, the SPE hardware first sends the first specified data obtained by the collection to the Linux kernel, and the Linux kernel reflects it to the user state through the mirror. Exemplarily, after the SPE hardware collects the first specified data, the first specified data can be sent to the Linux kernel, and then the Linux kernel stores the first specified data obtained by the collection in the perf ring buffer, so that the user state can obtain the first specified data obtained by the collection from the perf ring buffer.
[0067] 204. The user state performs data statistics on the plurality of designated data to obtain statistical data, where the plurality of designated data include the first designated data, and the statistical data includes the number of failed accesses to the first page table by each core in the multi-core processor.
[0068] Exemplarily, the SPE hardware collects the specified data 1 (IP1, TID1, time1, CPUID1, IDENTIFIER1) and the specified data 2 (IP2, TID2, time2, CPUID2, IDENTIFIER2), and the user state performs data statistics on the specified data 1 and the specified data 2 to obtain statistical data.
[0069] It should be noted that, when the user state receives the first designated data collected, the IP can be converted into an address (addr), and the Cpuid and TID can be recorded, with the TID being used as the process identifier (PID). Then, the user state can obtain the Cpuid and PID indicated by the last received characteristic data, as lastCpuid and lastPID, respectively, to obtain the information shown in Table 1:
[0070] Addr 0xaaaaca15095c Cpuid 35 Lastcpuid 36 Pid 20457 Lastpid 20457
[0071] Table 1
[0072] As shown in Table 1, it indicates that the address (addr) "0xaaaaca15095c" failed to be accessed by the core with Cpuid 35 this time, and the process identifier (PID) of the process where the page table corresponding to the address (addr) "0xaaaaca15095c" is located is "20457"; the address (addr) "0xaaaaca15095c" failed to be accessed by the core with Cpuid 36 last time, and the process identifier (PID) of the process where the page table corresponding to the address (addr) "0xaaaaca15095c" is located is also "20457".
[0073] In some possible implementations, if lastcpuid and cpuid appear to be the same multiple times, it means that the address (addr) is running stably on a core, and the data in the address (addr) should be in the memory corresponding to the NUMA node where the core is located. For example, lastcpuid and cpuid both indicate core 0, that is, the address (addr) is running stably on core 0, and the data in the address (addr) should be in the memory 0 corresponding to the NUMA node 0 where core 0 is located. If the address (addr) belongs to memory 0, there is no need to migrate; if the address (addr) does not belong to memory 0, the page table corresponding to the address (addr) needs to be migrated to memory 0.
[0074] In some possible implementations, if lastcpuid is different from cpuid for multiple times, it means that the address (addr) is running unstably on a core, and the page table corresponding to the address (addr) should not be migrated, otherwise repeated migration will occur.
[0075] In some possible implementations, the statistical data includes dst_page_faults and src_page_faults, dst_page_faults is the number of failed accesses of the second core to the first page table, and src_page_faults is the number of failed accesses of the first core to the first page table.
[0076] Exemplarily, after the user state receives the first designated data returned by the SPE hardware, the IP in the first designated data can be determined as the NUMA node corresponding to the address. If the NUMA node is a remote node of the core indicated by the cpuid in the designated data, the number of times the address and the core are accessed unsuccessfully is counted. Exemplarily, address 2 is in memory 1, memory 1 corresponds to NUMA node 1, address 2 corresponds to page table 2, page table 2 belongs to thread 2, thread 2 runs in core 1, core 1 belongs to NUMA node 0, and designated data 1 indicates that core 1 failed to access address 2, then the number of times core 1 failed to access address 2 is counted, recorded as dst_page_faults. For example, dst_page_faults = 6702.
[0077] In some possible implementations, after the user state receives the first designated data returned by the SPE hardware, the IP in the first designated data can be determined as the NUMA node corresponding to the address. If the NUMA node is the local node of the core indicated by the cpuid in the designated data, the number of times the address and the core are accessed unsuccessfully is counted. Exemplarily, address 1 is in memory 0, memory 0 corresponds to NUMA node 0, address 1 corresponds to page table 1, page table 1 belongs to thread 1, thread 1 runs on core 1, core 1 belongs to NUMA node 0, and designated data 1 indicates that core 1 failed to access address 1, then the number of times core 1 failed to access address 2 is counted, recorded as src_page_faults. For example, src_page_faults = 1453.
[0078] In some possible implementations, the user state can perform statistics on the specified data collected with a certain duration as a sampling period to obtain statistical data. After a sampling period ends, the computing device can attenuate the statistical data obtained in the previous sampling period by half in the next data statistical period to reduce the calculation weight. For example, at the end of a sampling period, src_page_faults=1453 can be attenuated to src_page_faults=727 (rounded), and dst_page_faults=6702 can be attenuated to dst_page_faults=3351.
[0079] In some possible implementations, the user state may also count the heat of a page table and the number of failed accesses to each page table corresponding to a process.
[0080] In some possible implementations, after the user state receives the first designated data returned by the SPE hardware, it can determine the page table corresponding to the IP in the first designated data as the address, and update the heat of the page table. Exemplarily, the original heat of page table 1 is 10 (that is, the page table has failed to be accessed 10 times in the statistical history). If the first designated data returned by the SPE hardware indicates that the page table 1 corresponding to address 1 has failed to be accessed again, the heat of page table 1 corresponding to address 1 is increased by 1, that is, 11=10+1. In some possible implementations, if the heat of the page table exceeds a preset value, the user state can display the heat of the page table.
[0081] In some possible implementations, after the user state receives the first designated data returned by the SPE hardware, it can determine the page table corresponding to the IP as the address in the first designated data, and determine the process corresponding to the page table, and then count the number of times each page table in the process fails to be accessed. Exemplarily, process 1 has thread 1 and thread 2, wherein thread 1 runs in core 1, thread 2 runs in core 2, thread 1 corresponds to address 1, and thread 2 corresponds to address 2. The IP in designated data 1 is address 1, corresponding to page table 1; the IP in designated data 2 is address 2, corresponding to page table 2. Then, the computing device can count the number of times page table 1 and page table 2 corresponding to process 1 fail to be accessed based on the received multiple designated data. For example, the number of times page table 1 fails to be accessed is 100 times, and the number of times page table 2 fails to be accessed is 200 times. In some possible implementations, the user state can display the number of times each page table in a process fails to be accessed.
[0082] 205. If the statistical data meets the preset migration rule, the user state migrates the first page table to the second memory.
[0083] In the embodiment of the present application, data statistics are performed on the collected designated data through the user state. After the statistical data is obtained, the user state can determine whether the page table needs to be migrated based on the following judgment logic:
[0084] Judgment logic 1: The second check fails to access the first page table or fails to access continuously for P times or more, and the ratio of src_page_faults to dst_page_faults is less than a preset ratio, where P is a positive integer greater than or equal to 2.
[0085] Exemplarily, when the page table corresponding to the address indicated by the IP fails to be accessed (or fails to be accessed continuously) P times (P is a positive integer, for example, P=2) by the same core at the remote end, and src_page_faults / dst_page_faults is less than MAGIC_NUM (MAGIC NUM is a custom preset parameter, for example, MAGIC_NUM=50%), the user state determines that the page table needs to be migrated to the memory corresponding to the remote core.
[0086] For example, address 1 pointed to by IP corresponds to page table 1, address 1 is in memory 0, page table 1 has failed to access (or failed to access continuously) 2 times (P=2) by remote core 32 (corresponding to memory 1), and based on statistical data, src_page_faults / dst_page_faults=1453 / 6702=21.68%, which is less than 50% (MAGIC_NUM=50%), then the user state needs to determine that page table 1 needs to be migrated from memory 0 to memory 1 corresponding to the remote core 32.
[0087] Judgment logic 2: dst_page_faults is M times of src_page_faults, where M is a positive integer.
[0088] Exemplarily, when the number of times a core fails to access the page table in the remote memory is M times (M is a preset multiple, for example, M=3) or more of the number of times the core fails to access the page table in the local memory, the user state determines that the page table needs to be migrated to the memory corresponding to the core.
[0089] For example, when the number of failed accesses to page table 1 in remote memory 1 by core 1 (corresponding to memory 0) is 300, and the number of failed accesses to page table 1 in local memory 0 by core 1 is 80, since 300>80*3 (M=3), the user state determines that page table 1 needs to be migrated from memory 1 to memory 0 corresponding to core 1.
[0090] It should be noted that migrating the page table means changing the correspondence between the page table and its corresponding address. Then, by unbinding the correspondence between the first page table and the first address and then binding the first page table and the second address, the first page table can correspond to the second address, and the second address belongs to the second memory.
[0091] Exemplarily, address 1 corresponds to page table 1, and address 1 belongs to memory 1 corresponding to NUMA node 1. Migrating page table 1 may be changing the correspondence between page table 1 and address 1 to correspondence between page table 1 and address 2, and migrating the data in the original address 1 to address 2, wherein address 2 belongs to memory 2 corresponding to NUMA node 2.
[0092] For example, Figure 2-3 As shown, when it is determined that the page table needs to be migrated, the address (addr) of the page table is first determined, then the memory where the address (addr) is located is determined, and then the NUMA node corresponding to the memory is determined as the source NUMA node. Next, the core running the address (addr) is determined, and then the NUMA node where the core is located is determined as the target NUMA node. Finally, the page table is migrated from the source NUMA node to the target NUMA node.
[0093] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0094] In order to better implement the above-mentioned solution of the embodiment of the present application, relevant devices for implementing the above-mentioned solution are also provided below.
[0095] See also Figure 3 As shown, a computing device 300 provided in an embodiment of the present application includes a multi-core processor, the multi-core processor includes a first core and a second core, the first core belongs to a first non-uniform memory access NUMA node, the second core belongs to a second NUME node, the first NUMA node corresponds to a first memory, and the second NUMA corresponds to a second memory;
[0096] The computing device 300 includes:
[0097] The serial-parallel expansion SPE hardware 301 is used for collecting first designated data corresponding to the first access failure event when a first access failure event occurs, the first designated data including a first address, an identifier of a first process, and an identifier of the second core, the access failure event is used to indicate that the second core fails to access a first page table, the first page table belongs to the first process, the first page table corresponds to the first address, and the first address belongs to the first memory;
[0098] A processing module 302 is used to perform data statistics on a plurality of designated data to obtain statistical data, wherein the plurality of designated data include the first designated data, and the statistical data includes a number of failed accesses to the first page table by each core in the multi-core processor;
[0099] The processing module 302 is further configured to migrate the first page table to the second memory if the statistical data satisfies a preset migration rule.
[0100] In some possible implementations, the processing module 302 is further used to enable the serial-to-parallel extension SPE option, and to send a run command to the SPE hardware based on the SPE option, wherein the run command is used to instruct the SPE hardware to collect the first specified data corresponding to the first access failure event when the first access failure event occurs.
[0101] In some possible implementations, the statistical data includes dst_page_faults and src_page_faults, wherein the dst_page_faults is the number of failed accesses of the second core to the first page table, and the src_page_faults is the number of failed accesses of the first core to the first page table.
[0102] In some possible implementations, the migration rule includes:
[0103] The second core fails to access the first page table or fails to access it continuously for P times or more, and the ratio of the src_page_faults to the dst_page_faults is less than a preset ratio, and P is a positive integer greater than or equal to 2; or
[0104] The dst_page_faults is M times the src_page_faults, where M is a positive integer.
[0105] In some possible implementations, the statistical data decays by half in the next data statistics cycle.
[0106] In some possible implementations, the processing module 302 is specifically configured to:
[0107] Unbinding the correspondence between the first page table and the first address;
[0108] The first page table and the second address are bound so that the first page table corresponds to the second address and the second address belongs to the second memory.
[0109] In some possible implementations, the statistical data also includes a total number of failed accesses by the CPU to the first page table; and the processing module 302 is further configured to display the total number of failed accesses.
[0110] It should be noted that the information interaction, execution process, etc. between the modules / units of the above-mentioned device are based on the same concept as the method embodiment of the present application, and the technical effects they bring are the same as those of the method embodiment of the present application. For specific contents, please refer to the description in the method embodiment shown above in the present application, and will not be repeated here.
[0111] An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a program, and the program executes some or all of the steps recorded in the above method embodiment.
[0112] Next, another communication device provided by the embodiment of the present application is introduced. Figure 4 As shown, the communication device 400 includes:
[0113] Receiver 401, transmitter 402, processor 403 and memory 404. In some embodiments of the present application, receiver 401, transmitter 402, processor 403 and memory 404 may be connected via a bus or other means, wherein: Figure 4 The example of connecting through bus is taken in the following.
[0114] The memory 404 may include a read-only memory and a random access memory, and provides instructions and data to the processor 403. A portion of the memory 404 may also include a non-volatile random access memory (NVRAM). The memory 404 stores an operating system and operating instructions, executable modules or data structures, or a subset thereof, or an extended set thereof, wherein the operating instructions may include various operating instructions for implementing various operations. The operating system may include various system programs for implementing various basic services and processing hardware-based tasks.
[0115] The processor 403 controls the operation of the communication device 400, and the processor 403 may also be referred to as a central processing unit (CPU). In a specific application, the various components of the communication device 400 are coupled together through a bus system, wherein the bus system may include a power bus, a control bus, and a status signal bus in addition to a data bus. However, for the sake of clarity, various buses are referred to as bus systems in the figure.
[0116] The method disclosed in the above embodiment of the present application can be applied to the processor 403, or implemented by the processor 403. The processor 403 can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 403. The above processor 403 can be a general processor, a digital signal processor (digital signal processing, DSP), an application specific integrated circuit (application specific integrated circuit, ASIC), a field programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to execute, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 404, and the processor 403 reads the information in the memory 404 and completes the steps of the above method in combination with its hardware.
[0117] The receiver 401 may be used to receive input digital or character information and generate signal input related to relevant settings and function control. The transmitter 402 may include a display device such as a display screen. The transmitter 402 may be used to output digital or character information through an external interface.
[0118] In the embodiment of the present application, the processor 403 is used to execute the aforementioned data processing method.
[0119] In another possible design, when the computing device 300 or the communication device 400 is a chip, it includes: a processing unit and a communication unit, the processing unit may be, for example, a processor, and the communication unit may be, for example, an input / output interface, a pin or a circuit, etc. The processing unit may execute the computer execution instructions stored in the storage unit, so that the chip in the terminal executes the method for sending wireless report information of any one of the above-mentioned first aspects. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc., and the storage unit may also be a storage unit in the terminal located outside the chip, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.
[0120] The processor mentioned in any of the above places may be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the program of the above method.
[0121] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0122] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including application-specific integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented with corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a magnetic disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0123] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0124] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, a computer, a server, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or a data center that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
Claims
1. A data processing method, characterized in that: Used for a multi-core processor, the multi-core processor includes a first core and a second core, the first core belongs to a first non-uniform memory access NUMA node, the second core belongs to a second NUMA node, the first NUMA node corresponds to a first memory, and the second NUMA corresponds to a second memory; The method comprises: When a first access failure event occurs, collecting first designated data corresponding to the first access failure event, the first designated data including a first address, an identifier of a first process, and an identifier of the second core, the access failure event is used to indicate that the second core fails to access a first page table, the first page table belongs to the first process, the first page table corresponds to the first address, and the first address belongs to the first memory; Performing data statistics on a plurality of designated data to obtain statistical data, wherein the plurality of designated data include the first designated data, and the statistical data include a number of failed accesses to the first page table by each core in the multi-core processor; If the statistical data meets the preset migration rule, the first page table is migrated to the second memory.
2. The method according to claim 1, characterized in that: The method further comprises: The serial-to-parallel extension SPE option is turned on, and a run command is issued to the SPE hardware based on the SPE option, wherein the run command is used to instruct the SPE hardware to collect first specified data corresponding to the first access failure event when the first access failure event occurs.
3. The method according to claim 1 or 2, characterized in that: The statistical data includes dst_page_faults and src_page_faults, wherein the dst_page_faults is the number of failed accesses of the second core to the first page table, and the src_page_faults is the number of failed accesses of the first core to the first page table.
4. The method according to claim 3, characterized in that: The migration rules include: The second core fails to access the first page table or fails to access it continuously for P times or more, and the ratio of the src_page_faults to the dst_page_faults is less than a preset ratio, and P is a positive integer greater than or equal to 2; or The dst_page_faults is M times the src_page_faults, where M is a positive integer.
5. The method according to any one of claims 1 to 4, characterized in that: The statistical data decays by half in the next data statistical cycle.
6. The method according to any one of claims 1 to 5, characterized in that: The migrating the first page table to the second memory includes: Unbinding the correspondence between the first page table and the first address; The first page table and the second address are bound so that the first page table corresponds to the second address and the second address belongs to the second memory.
7. The method according to any one of claims 1 to 6, characterized in that: The statistical data also includes the total number of failed accesses of the CPU to the first page table. The method also includes: Displays the total number of access failures.
8. A computing device, characterized in that A multi-core processor is included, the multi-core processor includes a first core and a second core, the first core belongs to a first non-uniform memory access NUMA node, the second core belongs to a second NUMA node, the first NUMA node corresponds to a first memory, and the second NUMA corresponds to a second memory; The computing device comprises: The serial-parallel expansion SPE hardware is used for collecting first designated data corresponding to a first access failure event when a first access failure event occurs, wherein the first designated data includes a first address, an identifier of a first process, and an identifier of the second core, wherein the access failure event is used to indicate that the second core fails to access a first page table, wherein the first page table belongs to the first process, and the first page table corresponds to the first address, and the first address belongs to the first memory; a processing module, configured to perform data statistics on a plurality of designated data to obtain statistical data, wherein the plurality of designated data include the first designated data, and the statistical data include a number of failed accesses to the first page table by each core in the multi-core processor; The processing module is further configured to migrate the first page table to the second memory if the statistical data meets a preset migration rule.
9. The computing device according to claim 8, characterized in that: The processing module is further used to enable the serial-to-parallel extension SPE option, and send a run command to the SPE hardware based on the SPE option, wherein the run command is used to instruct the SPE hardware to collect the first specified data corresponding to the first access failure event when the first access failure event occurs.
10. The computing device according to claim 8 or 9, characterized in that: The statistical data includes dst_page_faults and src_page_faults, wherein the dst_page_faults is the number of failed accesses of the second core to the first page table, and the src_page_faults is the number of failed accesses of the first core to the first page table.
11. The computing device according to claim 10, characterized in that: The migration rules include: The second core fails to access the first page table or fails to access it continuously for P times or more, and the ratio of the src_page_faults to the dst_page_faults is less than a preset ratio, and P is a positive integer greater than or equal to 2; or The dst_page_faults is M times the src_page_faults, where M is a positive integer.
12. The computing device according to any one of claims 8 to 11, characterized in that: The statistical data decays by half in the next data statistical cycle.
13. The computing device according to any one of claims 8 to 12, characterized in that: The processing module is specifically used for: Unbinding the correspondence between the first page table and the first address; The first page table and the second address are bound so that the first page table corresponds to the second address and the second address belongs to the second memory.
14. The computing device according to any one of claims 8 to 13, characterized in that: The statistical data also includes the total number of failed accesses of the CPU to the first page table; The processing module is also used to display the total number of access failures.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program, and the program causes a computer device to execute the method according to any one of claims 1 to 7.
16. A computer program product, characterized in that The computer program product includes computer-executable instructions, which are stored in a computer-readable storage medium; at least one processor of a device reads the computer-executable instructions from the computer-readable storage medium, and the at least one processor executes the computer-executable instructions so that the device performs the method as described in any one of claims 1-7.
17. A communication device, characterized in that: The communication device includes at least one processor, a memory and a communication interface; The at least one processor is coupled to the memory and the communication interface; The memory is used to store instructions, the processor is used to execute the instructions, and the communication interface is used to communicate with other communication devices under the control of the at least one processor; When the instructions are executed by the at least one processor, the at least one processor is caused to perform the method according to any one of claims 1 to 7.
18. A chip system, characterized in that: The chip system includes a processor and a memory, the memory and the processor are interconnected via a line, instructions are stored in the memory, and the processor is used to execute the method as described in any one of claims 1-7.
