Computer video memory sharing method and device, equipment and storage medium

By dividing the video memory physical page and attaching it to the kernel partner system, unified abstraction and data synchronization between video memory and memory is achieved, the problem of idle video memory resources is solved, the utilization rate of storage space is improved, and the hardware cost is reduced.

CN120276874AActive Publication Date: 2025-07-08NANJING SIETIUM SEMICON CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202510771694.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-11
Publication Date
2025-07-08
Estimated Expiration
2045-06-11

AI Technical Summary

Technical Problem

The prior art is difficult to efficiently utilize the storage space of computer systems, especially the video memory resources are idle and difficult to work efficiently with memory, resulting in low hardware resource utilization and high cost.

Method used

By dividing the free resources of video memory into physical pages and attaching them to the kernel partner system, the unified abstraction of video memory and physical pages of memory are realized, monitoring video memory/cache data synchronization, and dynamically sharing video memory resources to meet memory needs.

Benefits of technology

It improves the storage space utilization of computer systems, reduces dependence on physical memory, and optimizes the hardware cost structure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120276874A_ABST
    Figure CN120276874A_ABST
Patent Text Reader

Abstract

The invention discloses a computer video memory sharing method and device, equipment and a storage medium, and relates to the technical field of computers.The method comprises the steps that the use state of a video memory is obtained in real time to determine idle resources in the video memory; carrying out physical page division on idle resources in the video memory, and hooking a plurality of divided shared physical pages to a kernel partner system; in response to the memory application request, applying for a shared physical page from a kernel partner system; according to the use state of the video memory, sending a video memory application request to release the divided shared physical pages; and monitoring the video memory / cache, and when the video memory / cache data is changed, sending corresponding data to the cache / video memory so as to realize data synchronization of the cache and the video memory. The problem that the storage space of the computer system is difficult to use efficiently is solved, the use state of the video memory is obtained in real time, idle resources are hung to the kernel partner system and used as the memory, and efficient use of the storage space in the computer system is further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular, to a method, device, equipment and storage medium for sharing computer video memory. Background Art

[0002] In a personal computer system, memory (main memory) and video memory (graphics card memory) are two key data storage components. As the core data storage area for the operation of a computer system, memory is mainly responsible for temporarily storing program codes and data required for the operation of the CPU (Central Processing Unit), and has characteristics such as high-speed reading and writing and strong versatility, which is the basis for ensuring the smooth operation of the computer system. Video memory is a high-speed memory designed specifically for the Graphics Processing Unit (GPU), and is specifically used to store data such as textures and frame buffers required during the graphics rendering process. Its unique architecture design can meet the stringent requirements of the GPU for high-bandwidth and low-latency data access, and provides strong support for high-quality graphics rendering and complex computing tasks. Due to the differences in their hardware architectures and data management, memory and video memory usually operate in relatively independent working environments.

[0003] In the current personal computer hardware configuration, the video memory capacity of a graphics card usually ranges from 2GB to 32GB. However, in non-graphics rendering scenarios (such as daily office work, web browsing, etc.), the utilization rate of video memory is often low, and a large amount of video memory resources are idle. At the same time, the cost of the system memory for the host manufacturer can account for 10%-20% of the entire machine, which becomes an important factor affecting the overall pricing. If the idle video memory can be dynamically shared with the host system through technical means and used as general memory, it can not only improve the utilization rate of hardware resources, but also reduce the dependence of the entire machine on physical memory modules, thereby optimizing the cost structure.

[0004] Under the current technical conditions, the data interaction between the two needs to be achieved through specific hardware interfaces (such as the PCIe bus) and software protocols (such as DMA) to work together. However, this way of working together is difficult to ensure data consistency and still difficult to efficiently utilize the storage space of the computer system. Summary of the Invention

[0005] Embodiments of this application solve the problem in the prior art that it is difficult to efficiently utilize the storage space of a computer system by providing a method, device, equipment and storage medium for sharing computer video memory.

[0006] In a first aspect, an embodiment of the present application provides a method for sharing computer video memory, including: obtaining the usage status of the video memory in real time to determine the idle resources therein; performing physical page division on the idle resources in the video memory, and hanging the divided multiple shared physical pages to the kernel buddy system; applying for the shared physical pages from the kernel buddy system in response to a memory application request; sending a video memory application request to release the divided shared physical pages according to the usage status of the video memory; monitoring the video memory / cache, and when the data in the video memory / cache changes, sending the corresponding data to the cache / video memory to achieve data synchronization between the cache and the video memory.

[0007] In combination with the first aspect, in a possible implementation manner, the performing physical page division on the idle resources in the video memory and hanging the divided multiple shared physical pages to the kernel buddy system includes: performing physical page division on the idle resources in the video memory according to the size of the physical pages defined by the computer system to obtain multiple shared physical pages; and hanging the shared physical pages to the physical page linked list of the kernel buddy system based on the rules of the kernel buddy system.

[0008] In combination with the first aspect, in a possible implementation manner, the applying for the shared physical pages from the kernel buddy system in response to a memory application request includes: when the available resources of the video memory are lower than a set threshold, rejecting the memory application request; and when the available resources of the video memory reach the set threshold, allocating the required shared physical pages according to the memory application request.

[0009] In combination with the first aspect, in a possible implementation manner, the sending a video memory application request to release the divided shared physical pages according to the usage status of the video memory includes: when the available resources in the usage status of the video memory obtained in real time are sufficient, rejecting the video memory application request; and when the available resources in the usage status of the video memory obtained in real time are insufficient, releasing the divided shared physical pages from the kernel buddy system according to the video memory application request to meet the video memory requirements.

[0010] In combination with the first aspect, in a possible implementation manner, the monitoring the video memory / cache, and when the data in the video memory / cache changes, sending the corresponding data to the cache / video memory to achieve data synchronization between the cache and the video memory includes: monitoring the data change of the cache, and when there is data written into the cache, sending the corresponding data to the video memory; after receiving the corresponding data from the cache, the video memory writes the corresponding data into the video memory within the timeout period; monitoring the data change of the video memory, and when the data in the video memory changes, sending the corresponding changed data to the cache; and the cache performs data synchronization processing according to the received corresponding changed data from the video memory.

[0011] In a second aspect, an embodiment of the present application provides a computer video memory sharing device, including: a page table initialization module configured to perform physical page division on free resources in the video memory and hang a plurality of divided shared physical pages to the kernel buddy system; a video memory management module configured to obtain the usage status of the video memory in real time to determine free resources therein; apply for the shared physical pages from the kernel buddy system in response to a memory application request; release the applied shared physical pages according to the usage status of the video memory; a consistency management module configured to monitor the video memory / cache, and when the data in the video memory / cache changes, send corresponding data to the cache / video memory to achieve data synchronization between the cache and the video memory.

[0012] In combination with the second aspect, in a possible implementation manner, the video memory management module includes a GMU-A unit and a GMU-F unit; the GMU-F unit is used to obtain the usage status of the video memory in real time, and when the available resources in the usage status of the video memory are insufficient, release the converted shared physical pages from the kernel buddy system to meet the video memory requirements; the GMU-A unit is used to determine whether the available resources of the video memory reach a set threshold according to the memory application request, and reject the memory application request according to the judgment result, or allocate the required shared physical pages according to the memory application request.

[0013] In combination with the second aspect, in a possible implementation manner, the consistency management module includes a service proxy unit and a client proxy unit; the service proxy unit is used to monitor data changes in the cache, and when there is data written to the cache, send the corresponding data to the video memory; the client proxy unit is used to monitor data changes in the video memory, and when the data in the video memory changes, send the corresponding changed data to the cache.

[0014] In a third aspect, an embodiment of the present application provides a device for executing a computer video memory sharing method, the device including: a processor; a memory for storing processor-executable instructions; when the processor executes the executable instructions, the method described in the first aspect or any possible implementation manner of the first aspect is implemented.

[0015] In a fourth aspect, an embodiment of the present application provides a non-volatile computer-readable storage medium, the non-volatile computer-readable storage medium including computer programs or instructions for storage, and when the computer programs or instructions are executed, the method described in the first aspect or any possible implementation manner of the first aspect is implemented.

[0016] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: In the embodiments of the present application, by physically partitioning the video memory and attaching it to the kernel buddy system, the physical pages of the video memory and the memory can be uniformly abstracted, reducing external fragmentation of the video memory; by releasing the partitioned shared physical pages, the normal operation of the video memory can be ensured; by monitoring the video memory / cache and notifying the other party, data synchronization between the video memory and the cache can be achieved. This effectively solves the problem of difficult to efficiently utilize the storage space of the computer system, and further realizes real-time acquisition of the usage status of the video memory, attaching the idle resources to the kernel buddy system as memory for use, further improving the efficient utilization of the storage space in the computer system. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings required for use in the embodiments of the present application or the description of the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0018] Figure 1 It is a flowchart of a computer video memory sharing method provided by an embodiment of the present application; Figure 2 It is a schematic structural diagram of a computer video memory sharing device provided by an embodiment of the present application; Figure 3 It is a flowchart of the operation of the GMU-A unit provided by an embodiment of the present application; Figure 4 It is a flowchart of the operation of the GMU-F unit provided by an embodiment of the present application; Figure 5 It is a schematic structural diagram of a device for executing a computer video memory sharing method provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0019] The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts belong to the scope of protection of the present invention.

[0020] The following explains some of the technologies related to the embodiments of the present application to help understanding. It should be considered that they are only exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described here without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, some descriptions of well-known functions and structures are omitted in the following description.

[0021] Figure 1 It is a flowchart of a computer video memory sharing method provided by an embodiment of the present application, including steps 101 to 105. Among them, Figure 1 This is only an execution order shown in the embodiment of the present application, and does not represent the only execution order of a computer video memory sharing method. Under the condition that the final result can be achieved, Figure 1 the steps shown can be executed in parallel or reversed.

[0022] Step 101: Obtain the usage status of the video memory in real time to determine the idle resources therein. In the embodiment of the present application, during the operation of the computer, the management of the idle resources of the video memory is the key to the efficient operation of tasks. The video memory management is usually jointly completed by the GPU (graphics processing unit) driver and the hardware memory manager. Its core components include: a video memory allocator, which is responsible for allocating and releasing video memory blocks and maintaining the metadata of the idle video memory (idle resources). A page table / address mapping, which is used to map the virtual video memory address to the physical video memory address to achieve memory isolation and permission control. A fragmentation management mechanism, which is used to reduce video memory fragmentation by compressing or migrating data. A hardware status register, which provides a register interface for the GPU hardware, and the driver can query the usage status of the video memory. When the present application tracks the usage status of the video memory, the following methods can be adopted.

[0023] The usage status of the video memory can be obtained through the video memory allocator. Specifically, by using the linked list or tree structure in the kernel buddy system, the idle video memory blocks, that is, the idle resources, can be obtained.

[0024] The usage status of the video memory can also be obtained through the hardware status register. The GPU hardware provides a register interface, and the driver can obtain the total usage amount and the idle amount (that is, the idle resources) of the video memory through the global status register. The usage status of the video memory can also be queried through the API (data interface) provided by the video memory vendor. For example, NVIDIA (NVIDIA, a world-leading company in graphics processing units and artificial intelligence computing technologies) queries the available global video memory size and the allocated video memory size on the device through the cudaMemGetInfo() function to obtain the idle video memory (that is, the idle resources) and the total video memory.

[0025] Step 102: Physically divide the idle resources in the video memory and hang the multiple shared physical pages obtained by the division to the kernel buddy system. In the embodiment of the present application, the idle resources in the video memory are physically divided according to the size of the physical pages defined by the computer system to obtain multiple shared physical pages. Based on the rules of the kernel buddy system, the shared physical pages are hung to the memory physical page linked list of the kernel buddy system.

[0026] Specifically, a physical page is a fixed-size block into which the operating system divides physical memory, and each physical page is assigned a unique page frame number for the kernel to track its status and determine whether the physical page is free or allocated. The size of a physical page varies according to the architecture of the operating system and can be, for example, 4KB (kilobytes), 2MB (megabytes), or 1GB (gigabytes).

[0027] Further, the present application divides the idle resources of the video memory into multiple 4KB shared physical pages and assigns a page frame number to each shared physical page. Those skilled in the art should be aware that the physical pages referred to in the present application are physical pages divided from memory, and the shared physical pages referred to are physical pages divided from the idle resources of the video memory.

[0028] In an embodiment of the present application, the physical pages of memory are managed by the kernel buddy system. The kernel buddy system maintains multiple free lists, each list storing continuous physical pages of different sizes (different orders), and each physical page is organized in powers of 2 (such as 1 page, 2 pages, 4 pages, etc.). After dividing the idle resources of the video memory into shared physical pages, according to the rules of the kernel buddy system, the shared physical pages are attached to the memory physical page list of the kernel buddy system.

[0029] Specifically, all the divided shared physical pages are marked as free, and then the continuous shared physical pages are merged into larger blocks until no further merging is possible. For example, two consecutive shared physical pages with a size of 4KB are merged into an 8KB shared physical page. The merged shared physical pages are inserted into the corresponding free list of the kernel buddy system according to their sizes, that is, the shared physical pages are attached to the physical page list of the kernel buddy system.

[0030] In the present application, the idle resources of the video memory are divided into multiple shared physical pages and attached to the kernel buddy system, enabling the video memory to be directly managed by the kernel buddy system of the operating system, realizing the unified abstraction of the physical pages of the video memory and memory, and reducing the external fragmentation of the video memory.

[0031] Step 103: Apply to the kernel buddy system for shared physical pages in response to a memory application request. In an embodiment of the present application, when the available resources of the video memory are lower than a set threshold, the memory application request is rejected. When the available resources of the video memory reach the set threshold, the required shared physical pages are allocated according to the memory application request, as Figure 2 shown.

[0032] Specifically, the set threshold is exemplarily set to 20% of the video memory. In the case of normal memory resource allocation, when the available resources of the video memory obtained in real time are lower than 20%, when a process / thread applies for memory from the operating system, after the operating system receives the memory application request of the process / thread, if the available resources of the current video memory are lower than 20%, the memory application request will be rejected. If the available resources of the current video memory are greater than or equal to 20%, the idle resources of the current video memory will be divided into shared physical pages and attached to the kernel buddy system, and then according to the memory application request, the required memory (shared physical pages) will be allocated to the process / thread.

[0033] Those skilled in the art should be aware that steps 101 to 102 are carried out in real time. After the process / thread applies for and executes the current process / thread, the corresponding memory will be released. Therefore, during the execution of tasks, the idle resources of the memory or video memory are variable. And when sharing the idle resources of the video memory as memory, the requirements of the video memory itself should be satisfied first. Without affecting the video memory, the idle resources will be attached to the kernel buddy system as memory for sharing. Step 101 always determines the idle resources in the video memory when the available resources of the video memory are sufficient. Then step 102 divides the idle resources in the video memory into physical pages and attaches them to the kernel buddy system.

[0034] Step 104: Send a video memory application request to release the divided shared physical pages according to the usage status of the video memory. In the embodiment of the present application, when the available resources in the usage status of the video memory obtained in real time are sufficient, the video memory application request will be rejected. When the available resources in the usage status of the video memory obtained in real time are insufficient, the divided shared physical pages will be released from the kernel buddy system according to the video memory application request to meet the video memory requirements.

[0035] Specifically, when the method of the present application uses the idle resources in the video memory as memory for sharing, the requirements of the video memory itself need to be satisfied first, and then the idle resources will be attached to the kernel buddy system as memory.

[0036] Furthermore, when the computer is performing different tasks, the available resources required by the video memory are different. Therefore, the sufficiency of the "available resources" here is a quantity that changes in real time according to the task type and task process. For example, when the computer is performing daily office work, such as word processing, web browsing, and simple table making, these tasks have low requirements for the graphics processor and mainly use system memory. Only about 15% of the video memory is needed, and the available resources are sufficient. When playing local or online videos, relying on the video decoding chip and system memory, the video memory is mainly used for image rendering and display, and does not require a large amount of video memory resources. At this time, about 20% of the available resources of the video memory are sufficient. When playing some games with low requirements for graphics performance (low graphics quality, pixel art, static background, etc.), the graphics of these games are relatively simple, the texture resolution is low, and the scene complexity is not high. Therefore, a large amount of video memory is not required to store graphics data. Depending on the number of elements such as characters and special effects in the game, about 40%-60% of the available resources are sufficient. When playing some games with high requirements for graphics performance (realistic 3D rendering, ultra-high-definition textures, large-scale dynamic scenes, real-time computing special effects, etc.), these games have high-resolution textures, complex lighting effects, a large number of polygon models, and fine scene details, and require a large amount of video memory to store and process graphics data. When the video memory is insufficient, phenomena such as stuttering, frame drops, or screen tearing may occur in the game. In such scenarios, the available resources required by the video memory will reach 80%-95%, and even close to 100% in some extreme cases.

[0037] Those skilled in the art should be aware that in practical applications, the available resources of the video memory (resources required by the task) will also be affected by various factors such as hardware configuration (such as graphics card performance, video memory capacity, CPU performance, etc.), software optimization level, and programs running in the system background. Therefore, the judgment data on whether the above available resources are sufficient is only a rough range. In practical applications, the influence of hardware configuration, etc. also needs to be comprehensively considered. Usually, the judgment data of the available resources of the video memory will be slightly higher than its actual requirements.

[0038] As Figure 3 shown, according to the task type and task process currently executed by the computer, determine whether the available resources of the current video memory are sufficient. If the available resources of the current video memory are sufficient, then reject the release of the idle resources of the video memory that have been divided into shared physical pages, and the video memory application request fails. If the available resources of the current video memory are insufficient, then release the idle resources of the video memory that have been divided into shared physical pages in the kernel buddy system to meet the requirements of the video memory, that is, the video memory application request succeeds.

[0039] Step 105: Monitor the video memory / cache. When the data in the video memory / cache changes, send the corresponding data to the cache / video memory to achieve data synchronization between the cache and the video memory. In the embodiment of the present application, monitor the data change of the cache. When data is written into the cache, send the corresponding data to the video memory. After receiving the corresponding data from the cache, the video memory writes the corresponding data into the video memory within the timeout period. Monitor the data change of the video memory. When the data in the video memory changes, send the corresponding changed data to the cache. The cache performs data synchronization processing according to the received corresponding changed data from the video memory.

[0040] Specifically, through the cache coherence protocol of the CPU (such as MESI, a cache coherence protocol used to maintain cache coherence in a multi-processor system) or the memory management unit (MMU, a hardware module) of the GPU, detect the write operations and data modifications of the video memory or cache. For example, when the CPU modifies a certain cache line, the hardware marks this behavior as "dirty". Once it is monitored that the cache data on the CPU side is written or modified, the corresponding data is sent from the source (cache) to the target (video memory). Once it is monitored that the data in the video memory is written or modified, the corresponding changed data is sent from the source (video memory) to the target (cache) to ensure that the video memory and the cache have the same data copy and achieve data synchronization.

[0041] Although the present application provides method operation steps as described in the embodiments or flowcharts, based on routine or non-creative labor, there may be more or fewer operation steps. The step sequence listed in this embodiment is only one way among many step execution sequences and does not represent the only execution sequence. When the actual device or client product is executed, it can be executed in the method sequence shown in this embodiment or the drawings or in parallel (such as in an environment of parallel processors or multi-threaded processing).

[0042] As Figure 4 shown, the embodiment of the present application further provides a computer video memory sharing device 400. The device includes: a page table initialization module 410, a video memory management module 420, and a coherence management module 430. Among them, the video memory management module 420 includes a GMU-A unit 421 and a GMU-F unit 422, and the coherence management module 430 includes a service proxy unit 431 and a client proxy unit 432. Specifically as follows.

[0043] The page table initialization module 410 is configured to perform physical page partitioning on the idle resources in the video memory and hang the divided multiple shared physical pages to the kernel buddy system.

[0044] The video memory management module 420 is configured to obtain the usage status of the video memory in real time to determine the free resources therein. Apply to the kernel buddy system for shared physical pages in response to a memory application request. Release the applied shared physical pages according to the usage status of the video memory.

[0045] The consistency management module 430 is configured to monitor the video memory / cache. When the data in the video memory / cache changes, send the corresponding data to the cache / video memory to achieve data synchronization between the cache and the video memory.

[0046] The GMU-F unit 422 is used to obtain the usage status of the video memory in real time. When the available resources in the usage status of the video memory are insufficient, release the converted shared physical pages from the kernel buddy system to meet the video memory requirements.

[0047] The GMU-A unit 421 is used to determine whether the available resources of the video memory reach a set threshold according to a memory application request, and reject the memory application request according to the judgment result, or allocate the required shared physical pages according to the memory application request.

[0048] The service proxy unit 431 is used to monitor the data changes in the cache. When there is data written to the cache, send the corresponding data to the video memory.

[0049] The client proxy unit 432 is used to monitor the data changes in the video memory. When the data in the video memory changes, send the corresponding changed data to the cache.

[0050] As Figure 2 shown, specifically, in the case of normal memory resource allocation, when the available resources of the video memory obtained in real time are lower than 20%, when a process / thread applies for memory from the operating system, after the operating system receives the memory application request of the process / thread, the GMU-A unit processes the memory application request. First, it judges whether the available resources of the current video memory are lower than 20%. If the available resources of the current video memory are lower than 20%, the memory application request is rejected, and the memory request fails. If the available resources of the current video memory are greater than or equal to 20%, the free resources of the current video memory are divided into shared physical pages and attached to the kernel buddy system, and then according to the memory application request, allocate the required memory (shared physical pages) to the process / thread, and the memory request is successful.

[0051] As Figure 3As shown, according to the type and process of the task currently executed by the computer, a request for video memory is sent to the operating system. The operating system forwards the video memory application request to the GMU-F unit. The GMU-F unit first determines whether the available resources of the current video memory are sufficient. If the available resources of the current video memory are sufficient, it refuses to release the idle resources of the video memory that have been divided into shared physical pages, and the video memory application request fails. If the available resources of the current video memory are insufficient, it releases the idle resources of the video memory that have been divided into shared physical pages in the kernel buddy system to meet the video memory requirements, that is, the video memory application request is successful.

[0052] Some modules in the device described in this application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, classes, etc. that perform specific tasks or implement specific abstract data types. This application can also be practiced in a distributed computing environment, where tasks are executed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0053] The device or module clarified in the above application embodiments can be specifically implemented by a computer chip or entity, or by a product with a certain function. For the convenience of description, when describing the above device, various modules are described separately according to their functions. When implementing the embodiments of this application, the functions of each module can be implemented in one or more software and / or hardware. Of course, the module that implements a certain function can also be implemented by combining multiple sub-modules or sub-units.

[0054] The methods, devices or modules described in this application can be implemented in the form of computer-readable program codes. The controller can be implemented in any appropriate manner. For example, the controller can take the form of, for example, a microprocessor or a processor, a computer-readable medium storing computer-readable program codes (such as software or firmware) executable by the (micro)processor, logic gates, switches, application specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in the form of pure computer-readable program codes, the method steps can be logically programmed to enable the controller to be implemented in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, and embedded microcontrollers to achieve the same functions. Therefore, such a controller can be regarded as a hardware component, and the devices included therein for implementing various functions can also be regarded as the structures within the hardware component. Or even, the devices for implementing various functions can be regarded as either software modules for implementing the method or structures within the hardware component.

[0055] The embodiment of this application also provides a device 500 for executing a computer video memory sharing method. The device includes: a processor 502; a memory 501 for storing executable instructions of the processor 502; when the processor 502 executes the executable instructions, the method described in the embodiment of this application is implemented.

[0056] The embodiment of this application also provides a non-volatile computer-readable storage medium, on which a computer program or instruction is stored. When the computer program or instruction is executed, the method described in the embodiment of this application is implemented.

[0057] In addition, in each embodiment of the present invention, the various functional modules can be integrated in one processing module, or each module can exist alone, or two or more modules can be integrated in one module.

[0058] The above storage medium includes, but is not limited to, random access memory (English: Random Access Memory; abbreviation: RAM), read-only memory (English: Read-Only Memory; abbreviation: ROM), cache (English: Cache), hard disk drive (English: Hard Disk Drive; abbreviation: HDD), or memory card (English: Memory Card). The memory can be used to store computer program instructions.

[0059] From the description of the above embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary hardware. Based on such an understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product, or can also be embodied in the implementation process of data migration. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to enable a computer device (which can be a personal computer, mobile terminal, server, or network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments of this application.

[0060] The various embodiments in this specification are described in a progressive manner. For the same or similar parts between the various embodiments, reference can be made to each other. The key point of each embodiment is to illustrate the differences from other embodiments. All or part of this application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, mobile communication terminals, multi-processor systems, microprocessor-based systems, programmable electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and so on.

[0061] The above embodiments are only used to illustrate the technical solution of this application, rather than a limitation to this application; although this application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solution described in the foregoing embodiments, or perform equivalent replacement on some or all of the technical features therein; and these modifications or replacements do not make the essence of the corresponding technical solution deviate from the scope of the technical solution of this application.

Claims

1. A computer video memory sharing method, characterized in that, including: Obtain the usage status of the video memory in real time to determine the free resources therein; Perform physical page division on the free resources in the video memory, and attach the divided multiple shared physical pages to the kernel buddy system; Apply for the shared physical pages from the kernel buddy system in response to a memory application request; Send a video memory application request to release the divided shared physical pages according to the usage status of the video memory; Monitor the video memory / cache, and when the video memory / cache data changes, send the corresponding data to the cache / video memory to achieve data synchronization between the cache and the video memory.

2. The method according to claim 1, wherein The performing physical page division on the free resources in the video memory and attaching the divided multiple shared physical pages to the kernel buddy system includes: Perform physical page division on the free resources in the video memory according to the size of the physical pages defined by the computer system to obtain multiple shared physical pages; Based on the rules of the kernel buddy system, attach the shared physical pages to the physical page linked list of the kernel buddy system.

3. The method according to claim 1, characterized in that, The applying for the shared physical pages from the kernel buddy system in response to a memory application request includes: When the available resources of the video memory are lower than the set threshold, reject the memory application request; When the available resources of the video memory reach the set threshold, allocate the required shared physical pages according to the memory application request.

4. The method according to claim 1, characterized in that, The sending a video memory application request to release the divided shared physical pages according to the usage status of the video memory includes: When the available resources in the usage status of the video memory obtained in real time are sufficient, reject the video memory application request; When the available resources in the usage status of the video memory obtained in real time are insufficient, release the divided shared physical pages from the kernel buddy system according to the video memory application request to meet the video memory requirements.

5. The method according to claim 1, wherein The monitoring the video memory / cache and when the video memory / cache data changes, sending the corresponding data to the cache / video memory to achieve data synchronization between the cache and the video memory includes: Monitor the data change of the cache, and when there is data written to the cache, send the corresponding data to the video memory; After the video memory receives the corresponding data from the cache, write the corresponding data to the video memory within the timeout period; Monitor the data change of the video memory, and when the video memory data changes, send the corresponding changed data to the cache; The cache performs data synchronization processing according to the received corresponding changed data of the video memory.

6. A computer video memory sharing device, characterized in that including: A page table initialization module configured to perform physical page division on the free resources in the video memory and attach the divided multiple shared physical pages to the kernel buddy system; A video memory management module configured to obtain the usage status of the video memory in real time to determine the free resources therein; Apply for the shared physical pages from the kernel buddy system in response to a memory application request; release the applied shared physical pages according to the usage status of the video memory; A consistency management module configured to monitor the video memory / cache, and when the video memory / cache data changes, send the corresponding data to the cache / video memory to achieve data synchronization between the cache and the video memory.

7. The device according to claim 6, characterized in that, The video memory management module includes a GMU-A unit and a GMU-F unit; The GMU-F unit is used to obtain the usage status of the video memory in real time. When the available resources in the usage status of the video memory are insufficient, the converted shared physical pages are released from the kernel buddy system to meet the video memory requirements; The GMU-A unit is used to judge whether the available resources of the video memory reach a set threshold according to a memory application request, and reject the memory application request according to the judgment result, or allocate the required shared physical pages according to the memory application request.

8. The device according to claim 6, characterized in that, The consistency management module includes a service proxy unit and a client proxy unit; The service proxy unit is used to monitor data changes in the cache and send the corresponding data to the video memory when there is data written into the cache; The client proxy unit is used to monitor data changes in the video memory and send the corresponding changed data to the cache when the video memory data changes.

9. A device for performing a computer video memory sharing method, characterized in that, Comprising: A processor; A memory for storing processor-executable instructions; When the processor executes the executable instructions, the method described in any one of claims 1 to 5 is implemented.

10. A non-volatile computer-readable storage medium, characterized in that, Including for storing a computer program or instructions, when the computer program or instructions are executed, the method described in any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Server non-perception resource processing method and device and electronic equipment

    CN116401062A

  • GPU video memory application and release method and device and storage medium

    CN117194055A

  • Video memory page allocation method and device, computer equipment and storage medium

    CN119127506A

  • Task processing method and device, computer equipment and readable storage medium

    CN119597439A

  • Data processing method, device and equipment based on key value database, storage medium and key value database system

    CN119938713A