[go: up one dir, main page]

CN110795363B - Hot page prediction method and paging method for storage medium - Google Patents

Hot page prediction method and paging method for storage medium Download PDF

Info

Publication number
CN110795363B
CN110795363B CN201910791493.8A CN201910791493A CN110795363B CN 110795363 B CN110795363 B CN 110795363B CN 201910791493 A CN201910791493 A CN 201910791493A CN 110795363 B CN110795363 B CN 110795363B
Authority
CN
China
Prior art keywords
page
accessed
weight value
feature
pages
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910791493.8A
Other languages
Chinese (zh)
Other versions
CN110795363A (en
Inventor
郭怡欣
黄兴
汪小林
罗英伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Peking University Shenzhen Graduate School
Peng Cheng Laboratory
Original Assignee
Peking University Shenzhen Graduate School
Peng Cheng Laboratory
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Peking University Shenzhen Graduate School, Peng Cheng Laboratory filed Critical Peking University Shenzhen Graduate School
Priority to CN201910791493.8A priority Critical patent/CN110795363B/en
Publication of CN110795363A publication Critical patent/CN110795363A/en
Application granted granted Critical
Publication of CN110795363B publication Critical patent/CN110795363B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/12Replacement control
    • G06F12/121Replacement control using replacement algorithms
    • G06F12/123Replacement control using replacement algorithms with age lists, e.g. queue, most recently used [MRU] list or least recently used [LRU] list
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1016Performance improvement
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1028Power efficiency
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

A hot page prediction method and a page scheduling method of a storage medium are provided, wherein access information of N recently accessed pages in the storage medium is obtained, a weight value of the current accessed page is obtained according to the access information of the current accessed page and the access information of N recently accessed pages, hot page prediction is carried out on the accessed page according to the weight value of the accessed page, and the access information comprises access times and physical addresses. Because the hot page prediction is carried out on the accessed page according to the access times and the physical address in the access information, the efficiency and the accuracy of the hot page prediction are higher.

Description

一种存储介质的热页预测方法和页面调度方法Hot page prediction method and paging method for storage medium

技术领域technical field

本发明涉及存储器访问技术领域,具体涉及一种存储介质的热页预测方法和页面调度方法。The invention relates to the technical field of memory access, in particular to a hot page prediction method and a page scheduling method of a storage medium.

背景技术Background technique

随机存取存储器(random access memory,RAM)又称作“随机存储器”,是与CPU直接交换数据的内部存储器,也叫主存(内存)。它可以随时读写,而且速度很快,通常作为操作系统或其他正在运行中的程序的临时数据存储媒介。按照存储单元的工作原理,随机存储器又分为静态随机存储器(Static RAM,SRAM)和动态随机存储器(Dynamic RAM,DRAM)。随着数据规模不断增大,内存访问密集的应用不断增多,DRAM渐渐不能满足应用的需求。新兴的存储器件有着更大的存储密度,更低的价格,更低的能耗,但却有着延迟更高,且寿命有限的缺点,不能直接替代DRAM使用。例如,非易失存储器(non-volatile memory,NVM)是指断电后仍能保持数据的一种存储器,具有非易失、按字节存取、存储密度高、低能耗、读写性能接近DRAM,但读写速度不对称,寿命有限的特点。利用这种新型的存储器件和DRAM组成混合内存,可以很好地利用它们各自的优点。一种方式是将DRAM与NVM组成统一的地址空间,数据要么放在DRAM上,要么放在NVM上。由于DRAM与NVM延迟不同,所以将访问更多的热数据存储在DRAM中能大大降低内存的平均访问延迟。随着程序的运行,应用程序的热数据不是一成不变的,数据的冷热程度可能随时发生变化,所以需要根据热度的变化对数据进行迁移,时刻保证热度更高的数据存储在DRAM中。如何准确地识别热数据,并进行迁移,是平行混合内存架构需要解决的重要问题。Random access memory (random access memory, RAM), also known as "random access memory", is an internal memory that directly exchanges data with the CPU, and is also called main memory (memory). It can be read and written at any time, and the speed is very fast, and it is usually used as a temporary data storage medium for operating systems or other running programs. According to the working principle of the storage unit, random access memory is divided into static random access memory (Static RAM, SRAM) and dynamic random access memory (Dynamic RAM, DRAM). As the data scale continues to increase and memory access-intensive applications continue to increase, DRAM is gradually unable to meet the needs of applications. Emerging memory devices have greater storage density, lower prices, and lower energy consumption, but they have the disadvantages of higher latency and limited lifespan, and cannot directly replace DRAM. For example, non-volatile memory (non-volatile memory, NVM) refers to a kind of memory that can still retain data after power failure. It has non-volatile, byte-based access, high storage density, low energy consumption, and read and write performance close DRAM, but its reading and writing speed is asymmetrical and its lifespan is limited. Using this new type of storage device and DRAM to form a hybrid memory can make good use of their respective advantages. One way is to combine DRAM and NVM into a unified address space, and data is either placed on DRAM or NVM. Since the latency of DRAM is different from that of NVM, storing more hot data in DRAM can greatly reduce the average access latency of memory. With the running of the program, the hot data of the application is not static, and the hotness of the data may change at any time, so the data needs to be migrated according to the change of the heat, and the hotter data is always stored in the DRAM. How to accurately identify and migrate hot data is an important issue to be solved in the parallel hybrid memory architecture.

现有的混合内存页面调度技术主要对传统的LRU、CLOCK算法进行改进,利用局部性原理和读写请求按存储介质存放的基本原则,通过不同的数据结构实现了不同阶段页面的迁移操作。大致可以划分为被动式迁移、主动式迁移和主动和被动相结合的迁移方式。被动式页面迁移策略在主存未命中时将请求数据直接写到DRAM中,而当DRAM写满时便会触发迁移操作,再将访问频率低的冷页面或者读写倾向性不明确的页面迁移到NVM。这种被动迁移方式能够充分利用DRAM高读写带宽的特点,将尽可能多的写操作集中在DRAM,达到增加NVM寿命的目标。但是这种被动式迁移策略,缺乏从NVM到DRAM的写频繁页面迁移,读写预测机制的不足导致NVM写次数减少程度有限。主动式页面迁移策略通过访问频率和访问间隔定义页面的冷热,选择合适的数据结构开发时间局部性和空间局部性,并判断页面的读写倾向性进行相应的页迁移,保证DRAM存放写倾向页面,而NVM存放读倾向页面。这些方法能够有效预测页面的读写热度,在页面表现出读写倾向时执行迁移操作,但是需要较大的空间开销去记录读写访问频率和局部访问热度,并且各算法预测结果也存在较大差异。基于CLOCK提出一种主动和被动相结合的页面调度算法,对DRAM中的页面采取被动方式管理页面迁移到NVM,而对NVM中的页面采用主动方式区分写频繁页面,再迁移到DRAM。主动和被动相结合的页面调度算法能够充分发挥DRAM和NVM两种存储介质的优点,实现的开销也相对较小,但是这种管理方式会造成读写热度判断上的不统一,并且页面迁移比例也会出现差异。这些算法能够有效发挥DRAM写性能上的优势,控制NVM的写操作数量,但是普遍存在以下问题:第一、无法有效避免在混合内存介质之间频繁无效的页迁移,造成不必要的系统开销;第二、对于弱局部性应用场景下数据读写倾向性的预测效果不佳,容易产生不准确的迁移操作;第三、没有能够把尽可能多的读频繁数据迁移到NVM,不能进一步开发NVM读功耗和静态功耗低的优势。其中,所谓的弱时间局部性,从时间角度上讲,访问在时间维度上比较分散,不呈现出某一时间段对某一块数据集中访问的现象,称为弱时间局部性;从空间角度上讲,不呈现对某一地址范围集中访问的特性,称为弱空间局部性。The existing hybrid memory paging technology mainly improves the traditional LRU and CLOCK algorithms, utilizes the principle of locality and the basic principle that read and write requests are stored according to the storage medium, and realizes the migration operation of pages at different stages through different data structures. It can be roughly divided into passive migration, active migration and the combination of active and passive migration. The passive page migration strategy writes the requested data directly to the DRAM when the main memory misses, and triggers the migration operation when the DRAM is full, and then migrates the cold pages with low access frequency or pages with unclear read and write tendencies to the DRAM. NVM. This passive migration method can make full use of the high read and write bandwidth of DRAM, and concentrate as many write operations as possible on DRAM to achieve the goal of increasing the life of NVM. However, this passive migration strategy lacks write-frequent page migration from NVM to DRAM, and the insufficiency of the read-write prediction mechanism leads to a limited reduction in the number of NVM writes. The active page migration strategy defines the hotness and coldness of pages through access frequency and access interval, selects the appropriate data structure to develop temporal locality and spatial locality, and judges the read-write tendency of the page to perform corresponding page migration to ensure that the DRAM stores the write tendency pages, while NVM stores read-oriented pages. These methods can effectively predict the reading and writing heat of the page, and perform the migration operation when the page shows a tendency to read and write, but it requires a large space overhead to record the frequency of read and write access and local access heat, and the prediction results of each algorithm also have large differences. difference. Based on CLOCK, a paging algorithm combining active and passive is proposed. The pages in DRAM are passively managed to migrate to NVM, while the pages in NVM are actively distinguished by frequently written pages, and then migrated to DRAM. The active and passive paging algorithm can give full play to the advantages of DRAM and NVM storage media, and the implementation cost is relatively small, but this management method will cause inconsistency in the judgment of read and write heat, and the page migration ratio There are also differences. These algorithms can effectively take advantage of DRAM write performance and control the number of NVM write operations, but there are generally the following problems: First, frequent and invalid page migration between mixed memory media cannot be effectively avoided, resulting in unnecessary system overhead; Second, the prediction effect of data reading and writing tendency in weak locality application scenarios is not good, and inaccurate migration operations are prone to occur; third, it is not possible to migrate as much read-frequent data to NVM as possible, and NVM cannot be further developed The advantages of low read power consumption and static power consumption. Among them, the so-called weak temporal locality, from the perspective of time, the access is relatively scattered in the time dimension, and does not show the phenomenon of centralized access to a certain piece of data in a certain period of time, which is called weak temporal locality; from the perspective of space In other words, it does not exhibit the characteristic of concentrated access to a certain address range, which is called weak spatial locality.

可见,无论采取哪种迁移方式都需要对热页面进行有效的预测,并且对于不同的应用场景缺乏相适应的调度策略,尤其是在局部性较弱的情况下不能准确预测页面的读写热度,容易造成页面迁移频繁的问题,不能充分发挥混合内存系统的I/O性能和节能水平。因此,设计一种合理有效的热页预测方法对基于动态页排序的混合内存页面调度策略显得格外重要。It can be seen that no matter which migration method is adopted, effective prediction of hot pages is required, and there is a lack of suitable scheduling strategies for different application scenarios, especially in the case of weak locality, the read and write heat of pages cannot be accurately predicted. It is easy to cause the problem of frequent page migration, and the I/O performance and energy saving level of the hybrid memory system cannot be fully utilized. Therefore, it is particularly important to design a reasonable and effective hot page prediction method for hybrid memory paging strategies based on dynamic page sorting.

发明内容Contents of the invention

本发明主要解决的技术问题是现有技术中基于混合内存架构的热页预测方法的缺陷,而提出一种存储介质的热页预测方法和基于混合内存架构的页面调度方法。The technical problem mainly solved by the present invention is the defect of the hot page prediction method based on the hybrid memory architecture in the prior art, and a hot page prediction method of the storage medium and a paging method based on the hybrid memory architecture are proposed.

根据第一方面,一种实施例中提供一种存储介质的热页预测方法,包括:According to the first aspect, an embodiment provides a method for predicting hot pages of a storage medium, including:

获取所述存储介质中近期N个被访问页面的访问信息,其中所述访问信息包括访问次数和物理地址;Acquiring access information of recently N accessed pages in the storage medium, wherein the access information includes access times and physical addresses;

当存储介质有页面被访问时,依据当前被访问页面的访问信息和所述近期N个被访问页面的访问信息,获取当前被访问页面的权重值;When a page is accessed in the storage medium, the weight value of the currently accessed page is obtained according to the access information of the currently accessed page and the access information of the recent N accessed pages;

依据被访问页面的权重值对该被访问页面进行热页预测。Predict the hot page of the visited page according to the weight value of the visited page.

进一步,当当前被访问页面不在所述近期N个被访问页面中时,将当前被访问页面加入到所述近期N个被访问的页面中,并将当前被访问页面的访问次数设置为1,以更新所述近期N个被访问页面;依据当前被访问页面的访问信息获取该当前被访问页面的权重值;Further, when the currently visited page is not among the recent N visited pages, the currently visited page is added to the recently visited N pages, and the number of visits of the currently visited page is set to 1, to update the recent N visited pages; obtain the weight value of the currently visited page according to the visit information of the currently visited page;

当当前被访问页面在所述近期N个被访问的页面中时,将当前被访问页面的访问次数加1;获取当前被访问页面的物理地址;依据当前被访问页面的物理地址和访问次数对该当前被访问页面的权重值进行更新。When the currently accessed page is in the recently N accessed pages, add 1 to the number of visits of the currently accessed page; obtain the physical address of the currently accessed page; The weight value of the currently visited page is updated.

当当前被访问页面不在所述近期N个被访问页面中时,将当前被访问页面加入到所述近期N个被访问页面中时,应用最近最少使用算法在所述近期N个被访问页面中剔除一个页面,并将当前被访问页面加入到所述近期N个被访问页面中;When the currently visited page is not in the recent N visited pages, when adding the currently visited page to the recent N visited pages, apply the least recently used algorithm in the recent N visited pages Excluding a page, and adding the currently visited page to the recent N visited pages;

记录该被剔除页面的访问次数作为该页面下一次进入所述近期N个被访问页面中时的历史访问次数。The number of visits to the removed page is recorded as the historical number of visits when the page enters the recent N visited pages next time.

进一步,对所述被剔除页面的访问次数进行量子化处理;Further, perform quantization processing on the number of visits of the excluded pages;

记录进行量子化处理后的结果,以作为所述被剔除页面下一次进入所述近期N个被访问页面中时的历史访问次数;Recording the result after quantization processing as the historical access times when the rejected page enters the recent N accessed pages next time;

按以下规则对所述访问次数进行量子化处理:Quantize the access times according to the following rules:

当访问次数是0时,则量子化的结果为0;When the number of visits is 0, the result of quantization is 0;

当访问次数是1至8时,则量子化的结果为1;When the number of visits is 1 to 8, the result of quantization is 1;

当访问次数是9至31时,则量子化的结果为2;When the number of visits is 9 to 31, the result of quantization is 2;

当访问次数大于31时,则量子化的结果为3。When the number of visits is greater than 31, the result of quantization is 3.

根据第二方面,一种实施例中提供一种基于混合内存架构的页面调度方法,所述混合内存包括第一存储介质和第二存储介质,所述第一存储介质的访问延迟小于第二存储介质的访问延迟;所述方法包括:According to the second aspect, an embodiment provides a paging method based on a hybrid memory architecture, the hybrid memory includes a first storage medium and a second storage medium, and the access latency of the first storage medium is smaller than that of the second storage medium. The access delay of medium; described method comprises:

依据第一方面所述热页预测方法对所述第一存储介质和第二存储介质中被访问页面进行热页预测;Perform hot page prediction on the accessed pages in the first storage medium and the second storage medium according to the hot page prediction method in the first aspect;

将所述近期N个被访问页面中权重值高的被访问页面放置于第一存储介质。Place the accessed page with a higher weight value among the recent N accessed pages in the first storage medium.

进一步,将第一存储介质的每一个页面和第二存储介质的多个页面建立对应关系以构成一个页面交换组;Further, establishing a corresponding relationship between each page of the first storage medium and multiple pages of the second storage medium to form a page exchange group;

将每个所述页面交换组中权重值最高的页面存储在第一存储介质中。The page with the highest weight value in each page exchange group is stored in the first storage medium.

依据上述实施例的一种存储介质的热页预测方法和页面调度方法,通过获取存储介质中近期N个被访问页面的访问信息,并依据当前被访问页面的访问信息,获取当前被访问页面的权重值,并依据被访问页面的权重值对该被访问页面进行热页预测,其中访问信息包括访问次数和物理地址。由于依据访问信息中的访问次数和物理地址对被访问页面进行热页预测,使得热页预测的效率和准确率更高。According to a hot page prediction method and a page scheduling method of a storage medium in the above-mentioned embodiments, by acquiring the access information of recently N accessed pages in the storage medium, and according to the access information of the currently accessed page, the access information of the currently accessed page is obtained. weight value, and perform hot page prediction on the accessed page according to the weight value of the accessed page, wherein the access information includes access times and physical addresses. Since the hot page prediction is performed on the accessed page according to the number of visits and the physical address in the access information, the efficiency and accuracy of the hot page prediction are higher.

附图说明Description of drawings

图1为一种实施例中基于混合内存架构的内存系统的结构示意图;FIG. 1 is a schematic structural diagram of a memory system based on a hybrid memory architecture in an embodiment;

图2为一种实施例中热页预测器的结构框图;Fig. 2 is a structural block diagram of a hot page predictor in an embodiment;

图3为一种实施例中热页预测单元的结构框图;Fig. 3 is a structural block diagram of a hot page prediction unit in an embodiment;

图4为一种实施例中第一存储介质和第二存储介质分组示意图;Fig. 4 is a schematic diagram of grouping a first storage medium and a second storage medium in an embodiment;

图5为一种实施例中热页预测方法的流程示意图;Fig. 5 is a schematic flowchart of a hot page prediction method in an embodiment;

图6为一种实施例中第一特征权重值的获取方法的流程示意图;FIG. 6 is a schematic flowchart of a method for obtaining a first feature weight value in an embodiment;

图7为一种实施例中第二特征权重值的获取方法的流程示意图;FIG. 7 is a schematic flowchart of a method for obtaining a second feature weight value in an embodiment;

图8为一种实施例中第三特征权重值的获取方法的流程示意图;FIG. 8 is a schematic flowchart of a method for obtaining a third feature weight value in an embodiment;

图9为与MDM算法比较DRAM访问率的对比示意图;Fig. 9 is a schematic diagram of comparing the DRAM access rate with the MDM algorithm;

图10为与MDM算法比较NVM写数量的对比示意图;Figure 10 is a schematic diagram of comparing the number of NVM writes with the MDM algorithm;

图11为不同权重表下DRAM访问率对比示意图;Figure 11 is a schematic diagram of the comparison of DRAM access rates under different weight tables;

图12另一种实施例中基于混合内存架构的页面调度方法流程示意图。FIG. 12 is a schematic flowchart of a paging method based on a hybrid memory architecture in another embodiment.

具体实施方式Detailed ways

下面通过具体实施方式结合附图对本发明作进一步详细说明。其中不同实施方式中类似元件采用了相关联的类似的元件标号。在以下的实施方式中,很多细节描述是为了使得本申请能被更好的理解。然而,本领域技术人员可以毫不费力的认识到,其中部分特征在不同情况下是可以省略的,或者可以由其他元件、材料、方法所替代。在某些情况下,本申请相关的一些操作并没有在说明书中显示或者描述,这是为了避免本申请的核心部分被过多的描述所淹没,而对于本领域技术人员而言,详细描述这些相关操作并不是必要的,他们根据说明书中的描述以及本领域的一般技术知识即可完整了解相关操作。The present invention will be further described in detail below through specific embodiments in conjunction with the accompanying drawings. Wherein, similar elements in different implementations adopt associated similar element numbers. In the following implementation manners, many details are described for better understanding of the present application. However, those skilled in the art can readily recognize that some of the features can be omitted in different situations, or can be replaced by other elements, materials, and methods. In some cases, some operations related to the application are not shown or described in the description, this is to avoid the core part of the application being overwhelmed by too many descriptions, and for those skilled in the art, it is necessary to describe these operations in detail Relevant operations are not necessary, and they can fully understand the relevant operations according to the description in the specification and general technical knowledge in the field.

另外,说明书中所描述的特点、操作或者特征可以以任意适当的方式结合形成各种实施方式。同时,方法描述中的各步骤或者动作也可以按照本领域技术人员所能显而易见的方式进行顺序调换或调整。因此,说明书和附图中的各种顺序只是为了清楚描述某一个实施例,并不意味着是必须的顺序,除非另有说明其中某个顺序是必须遵循的。In addition, the characteristics, operations or characteristics described in the specification can be combined in any appropriate manner to form various embodiments. At the same time, the steps or actions in the method description can also be exchanged or adjusted in a manner obvious to those skilled in the art. Therefore, the various sequences in the specification and drawings are only for clearly describing a certain embodiment, and do not mean a necessary sequence, unless otherwise stated that a certain sequence must be followed.

本文中为部件所编序号本身,例如“第一”、“第二”等,仅用于区分所描述的对象,不具有任何顺序或技术含义。而本申请所说“连接”、“联接”,如无特别说明,均包括直接和间接连接(联接)。The serial numbers assigned to components in this document, such as "first", "second", etc., are only used to distinguish the described objects, and do not have any sequence or technical meaning. The "connection" and "connection" mentioned in this application all include direct and indirect connection (connection) unless otherwise specified.

现有技术中已提出多种迁移方式,但这些迁移方式在热页预测时仅仅考虑了单一的特征,只通过页面历史访问频度来识别热页。但有时单一的频度特征并不能很好地反应数据未来的热度,结合多个特征才能更准确地识别热页。在不同阶段,反映页面热度的特征可能不同。在某些时候,反映不同页面的热度的特征也可能不同,仅使用单个特征可能得到错误的结果。例如,考虑两个内存访问序列:A variety of migration methods have been proposed in the prior art, but these migration methods only consider a single feature when predicting hot pages, and only identify hot pages by historical page access frequency. But sometimes a single frequency feature cannot reflect the future popularity of the data well, and combining multiple features can identify hot pages more accurately. At different stages, the characteristics reflecting the popularity of the page may be different. At some point, the features that reflect the popularity of different pages may also be different, and using only a single feature may get wrong results. For example, consider two sequences of memory accesses:

1)ACCCD…1) ACCCD...

2)BCC…CCE…2)BCC...CCE...

在这两种情况下,页面C都不会再次被访问,如果仅基于访问次数判断(被页面被访问了n次,为热页,进行迁移),则在两种情况下(n=3),页面C都将被识别为热页面,在被访问3次之后迁移到DRAM。但实际上在第一种情况下,C将永远不会再次被访问,如果迁移它将产生不必要的开销。如果通过它们的上一个被访问的页面帮助进一步判断,则可以区分这两种情况并更准确地预测热页。在上面的例子中,如果前一个访问的页面是A,那么页面C不会是热页,如果前一个访问的页面是B那么页面C会是一个热页。所以此时可以选取页面此时的访问次数和历史访问次数、前序访问页面的地址和访问的当前页面的地址等特征。我们可以对每个特征,记录下页面在不同特征值下为热页的概率。例如,对于访问次数这个特征,当页面被访问1,2...n次时,记录页面是热页面的概率p1,p2...pn。因为在相同特征下不同页面是热页的概率是不同的,因此有必要在每个特征的不同值下记录每个页面是热页面的概率。但这个开销将十分巨大,不可接受。因此,我们借鉴了在预测缓存中页面重用和分支预测中使用的方式,预测不同页面在不同特征值下为热页的概率。In both cases, page C will not be accessed again. If it is judged only based on the number of visits (the page has been accessed n times, it is a hot page, and it is migrated), then in both cases (n=3) , Page C will be recognized as a hot page and will be migrated to DRAM after being accessed 3 times. But actually in the first case, C will never be accessed again, and it would incur unnecessary overhead if migrated. If further judgment is aided by their last visited page, it is possible to distinguish between these two cases and predict hot pages more accurately. In the above example, if the previously accessed page is A, then page C will not be a hot page, and if the previously accessed page is B then page C will be a hot page. Therefore, at this time, features such as the number of visits to the page at this time and the number of historical visits, the address of the previously visited page, and the address of the currently visited page can be selected. For each feature, we can record the probability that the page is a hot page under different feature values. For example, for the feature of number of visits, when the page is accessed 1, 2...n times, the probability p1, p2...pn of the recorded page is a hot page. Because different pages have different probabilities of being a hot page under the same feature, it is necessary to record the probability of each page being a hot page at different values of each feature. But this cost will be huge and unacceptable. Therefore, we borrow the methods used in predicting page reuse and branch prediction in the cache to predict the probability that different pages are hot pages under different feature values.

在本申请实施例中,通过获取存储介质中近期N个被访问页面的访问信息,并依据当前被访问页面的访问信息,获取当前被访问页面的权重值,并依据被访问页面的权重值对该被访问页面进行热页预测,其中访问信息包括访问次数和物理地址。由于依据近期N个被访问页面的访问信息中的访问次数和物理地址,对被访问页面进行热页预测,使得热页预测的效率和准确率更高。In the embodiment of the present application, by obtaining the access information of recently N accessed pages in the storage medium, and according to the access information of the currently accessed page, the weight value of the currently accessed page is obtained, and according to the weight value of the accessed page Hot page prediction is performed on the accessed page, where the access information includes access times and physical addresses. Since the hot page prediction is performed on the accessed pages according to the access times and physical addresses in the access information of the recently N accessed pages, the efficiency and accuracy of the hot page prediction are higher.

实施例一:Embodiment one:

请参考图1,为一种实施例中基于混合内存架构的内存系统的结构示意图,包括第一存储介质30、第二存储介质20和内存控制器10。其中,第一存储介质30的访问延迟小于第二存储介质20的访问延迟。内存控制器10包括热页预测器11,用于获取第一存储介质和第二存储介质中近期N个被访问页面的访问信息,还用于当第一存储介质或第二存储介质有页面被访问时,依据当前被访问页面的访问信息和近期N个被访问页面的访问信息,获取当前被访问页面的权重值,再依据被访问页面的权重值对该被访问页面进行热页预测。其中访问信息包括访问次数和物理地址,N为自然数。内存控制器10用于将权重值高的页面放置于第一存储介质30中。内存控制器10还包括多个特征权重表12,用于记录任一被访问页面一特征的特征值所对应的权重值。每个特征权重表包括多个特征索引值和与该索引值相对应的特征权重值。Please refer to FIG. 1 , which is a schematic structural diagram of a memory system based on a hybrid memory architecture in an embodiment, including a first storage medium 30 , a second storage medium 20 and a memory controller 10 . Wherein, the access delay of the first storage medium 30 is smaller than the access delay of the second storage medium 20 . The memory controller 10 includes a hot page predictor 11, configured to obtain access information of recently N accessed pages in the first storage medium and the second storage medium, and also used for when a page in the first storage medium or the second storage medium is accessed When accessing, the weight value of the currently visited page is obtained according to the visit information of the currently visited page and the visit information of the recent N visited pages, and then the hot page prediction of the visited page is performed according to the weight value of the visited page. The access information includes access times and physical addresses, and N is a natural number. The memory controller 10 is configured to place pages with high weight values in the first storage medium 30 . The memory controller 10 also includes a plurality of feature weight tables 12 for recording the weight value corresponding to any feature value of a feature of an accessed page. Each feature weight table includes a plurality of feature index values and feature weight values corresponding to the index values.

请参考图2,为一种实施例中热页预测器的结构框图,热页预测器11包括N个热页预测单元,每个热页预测单元用于记录一个近期被访问页面的访问次数,还用于记录该近期被访问页面的权重值。一实施例中,热页预测单元采用物理页号对所记录页面进行索引。Please refer to FIG. 2 , which is a structural block diagram of a hot page predictor in an embodiment. The hot page predictor 11 includes N hot page prediction units, and each hot page prediction unit is used to record the number of visits of a recently visited page. It is also used to record the weight value of the recently visited page. In one embodiment, the hot page prediction unit uses the physical page number to index the recorded pages.

请参考图3,为一种实施例中热页预测单元的结构框图,以第一热页预测单元111为例,每个热页预测单元都记录该页面的访问次数1111、特征索引值1112、历史访问次数1113和权重值1114。内存控制器10用于当当前被访问页面的物理地址没有记录在热页预测器11中时,热页预测器11将当前被访问页面的物理地址记录在热页预测器11中的一个热页预测单元中,并将该热页预测单元中的访问次数设置为1,热页预测器11依据当前被访问页面的访问次数和物理地址获取该当前被访问页面的权重值,并记录在该热页预测单元中,即记录在热页预测单元的权重值位置上;当当前被访问页面的物理地址记录在热页预测器11中时,热页预测器11将记录当前被访问页面的热页预测单元中的访问次数加1,并依据当前被访问页面的访问次数和物理地址对该热页预测单元中的权重值进行更新;当当前被访问页面的物理地址没有记录在热页预测器11中,且热页预测器11的热页预测单元都已满时,热页预测器11中还用于应用最近最少使用算法剔除一个页面,并将当前被访问页面记录在该所述热页预测器中。最近最少使用算法(Least Recently Used,LRU),是为虚拟页式存储管理服务的,是根据页面调入后的使用情况进行决策的。由于无法预测各页面将来的使用情况,只能利用“最近的过去”作为“最近的将来”的近似,因此,LRU算法就是将最近最久未使用的页面予以淘汰。一实施例中,热页预测器11采用一个特殊的栈来记录近期N个被访问页面的页面信息。当当前被访问页面要记录在热页预测器11中时,便将当前被访问页面压入栈顶,其它的页面往栈底移,如果热页预测器11中热页预测单元以满,则将栈底的页面移除。这样,栈顶始终是最新被访问页面,而栈底则是最近最久未访问的页面。Please refer to FIG. 3 , which is a structural block diagram of a hot page prediction unit in an embodiment. Taking the first hot page prediction unit 111 as an example, each hot page prediction unit records the number of visits 1111, feature index value 1112, The number of historical visits is 1113 and the weight value is 1114. The memory controller 10 is used for when the physical address of the currently accessed page is not recorded in the hot page predictor 11, the hot page predictor 11 records the physical address of the currently accessed page in a hot page in the hot page predictor 11 In the prediction unit, and the number of accesses in the hot page prediction unit is set to 1, the hot page predictor 11 obtains the weight value of the currently accessed page according to the number of accesses and the physical address of the currently accessed page, and records it in the hot page In the page prediction unit, it is recorded on the weight value position of the hot page prediction unit; when the physical address of the currently accessed page is recorded in the hot page predictor 11, the hot page predictor 11 will record the hot page of the currently accessed page The number of visits in the prediction unit is increased by 1, and the weight value in the hot page prediction unit is updated according to the number of visits and the physical address of the currently accessed page; when the physical address of the currently accessed page is not recorded in the hot page predictor 11 , and when the hot page prediction units of the hot page predictor 11 are full, the hot page predictor 11 is also used to remove a page by applying the least recently used algorithm, and record the currently accessed page in the hot page prediction device. The least recently used algorithm (Least Recently Used, LRU) is for the management of virtual paging storage, and it makes decisions based on the usage of the page after it is loaded. Since the future usage of each page cannot be predicted, the "recent past" can only be used as an approximation of the "near future". Therefore, the LRU algorithm is to eliminate the pages that have not been used for the longest time. In one embodiment, the hot page predictor 11 uses a special stack to record page information of recently N accessed pages. When the currently accessed page is to be recorded in the hot page predictor 11, the currently accessed page is pushed into the top of the stack, and other pages are moved to the bottom of the stack, if the hot page prediction unit in the hot page predictor 11 is full, then Remove the page at the bottom of the stack. In this way, the top of the stack is always the latest accessed page, while the bottom of the stack is the page that has not been accessed the most recently.

一实施例中,第一存储介质用于记录被剔除页面的访问次数作为该被剔除页面下一次进入热页预测器11中时的历史访问次数,或先对该被剔除页面的访问次数进行量子化处理,将进行量子化处理后的结果作为该被剔除页面下一次进入热页预测器11中时的历史访问次数。In one embodiment, the first storage medium is used to record the number of accesses of the removed page as the historical number of accesses when the removed page enters the hot page predictor 11 next time, or quantify the number of times of access to the removed page first. Quantization processing, the result after the quantization processing is used as the historical access times when the rejected page enters the hot page predictor 11 next time.

一实施例中,按以下规则对访问次数进行量子化处理:In one embodiment, the access times are quantized according to the following rules:

当访问次数是0时,则量子化的结果为0;When the number of visits is 0, the result of quantization is 0;

当访问次数是1至8时,则量子化的结果为1;When the number of visits is 1 to 8, the result of quantization is 1;

当访问次数是9至31时,则量子化的结果为2;When the number of visits is 9 to 31, the result of quantization is 2;

当访问次数大于31时,则量子化的结果为3。When the number of visits is greater than 31, the result of quantization is 3.

当当前被访问页面的物理地址不在热页预测器11中时,热页预测器11还用于从第一介质读取当前被访问页面的历史访问次数,并将历史访问次数记录在该页面的热页预测单元中,即记录在热页预测单元的历史访问次数位置。When the physical address of the currently accessed page is not in the hot page predictor 11, the hot page predictor 11 is also used to read the historical access times of the currently accessed page from the first medium, and record the historical access times in the page In the hot page prediction unit, it is recorded in the position of the historical access times of the hot page prediction unit.

一实施例中,内存控制器10还包括多个特征权重表,即第一特征权重表、第二特征权重表和/或第三特征权重表。第一特征权重表包括多个第一特征索引值和与该索引值相对应的第一特征权重值,是用于记录第一存储介质和第二存储介质中任一被访问页面的访问次数与第一特征权重值的对应关系。第二特征权重表包括多个第二特征索引值和与该索引值相对应的第二特征权重值,是用于记录第一存储介质和第二存储介质中任一被访问页面的历史访问次数与第二特征权重值的对应关系。第三特征权重表包括多个第三特征索引值和与该索引值相对应的第三特征权重值,是用于记录之前被访问页面的物理地址与第三特征权重值的对应关系。一实施例中,之前被访问页面的物理地址包括前一次被访问页面的物理地址或前两次被访问页面的物理地址,即当前被访问页面的物理地址作为下一次被访问页面的第三特征,和/或相对于当前被访问页面的前一次被访问页面的物理地址作为下一次被访问页面的第三特征。每个热页预测单元还记录被访问页面的第一特征索引值、第二特征索引值和/或第三特征索引值,以用于依据该被访问页面的第一特征索引值、第二特征索引值和/或第三特征索引值获取该被访问页面的权重值。热页预测单元还用于记录第一特征权重值、第二特征权重值和/或第三特征权重值之和,以作为被访问页面的权重值,记录在该热页预测单元的权重值位置。其中,第一特征权重值、第二特征权重值和/或第三特征权重值是依据该被访问页面的第一特征索引值、第二特征索引值和/或第三特征索引值获得的,即通过索引值在特征权重表获取该索引值对应的权重值。In an embodiment, the memory controller 10 further includes a plurality of feature weight tables, namely a first feature weight table, a second feature weight table and/or a third feature weight table. The first feature weight table includes a plurality of first feature index values and first feature weight values corresponding to the index values, and is used to record the number of visits and the number of visits of any accessed page in the first storage medium and the second storage medium. The corresponding relationship of the weight value of the first feature. The second feature weight table includes a plurality of second feature index values and second feature weight values corresponding to the index values, and is used to record the historical access times of any accessed page in the first storage medium and the second storage medium The corresponding relationship with the second feature weight value. The third feature weight table includes a plurality of third feature index values and third feature weight values corresponding to the index values, and is used to record the correspondence between the physical addresses of previously accessed pages and the third feature weight values. In one embodiment, the physical address of the previously accessed page includes the physical address of the previously accessed page or the physical addresses of the previous two accessed pages, that is, the physical address of the currently accessed page is used as the third feature of the next accessed page , and/or the physical address of the previously accessed page relative to the currently accessed page as the third feature of the next accessed page. Each hot page prediction unit also records the first feature index value, the second feature index value and/or the third feature index value of the accessed page, so as to use the first feature index value and the second feature index value of the accessed page The index value and/or the third characteristic index value obtains the weight value of the visited page. The hot page prediction unit is also used to record the sum of the first feature weight value, the second feature weight value and/or the third feature weight value as the weight value of the accessed page, which is recorded in the weight value position of the hot page prediction unit . Wherein, the first characteristic weight value, the second characteristic weight value and/or the third characteristic weight value are obtained according to the first characteristic index value, the second characteristic index value and/or the third characteristic index value of the accessed page, That is, the weight value corresponding to the index value is obtained in the feature weight table through the index value.

一实施例中,当当前被访问页面的物理地址记录在热页预测器11中,且当前被访问页面的权重值大于一预设值时,热页预测器11不对当前被访问页面的权重值进行更新。即当热页预测器11中一热页预测单元记录的权重值大于一预设值时,不在增加该预测单元记录的权重值。In one embodiment, when the physical address of the currently accessed page is recorded in the hot page predictor 11, and the weight value of the currently accessed page is greater than a preset value, the hot page predictor 11 does not calculate the weight value of the currently accessed page. to update. That is, when the weight value recorded by a hot page prediction unit in the hot page predictor 11 is greater than a preset value, the weight value recorded by the prediction unit is not increased.

一实施例中,第一存储介质包括地址重映射表,用于将被访问页面的物理地址翻译为真实地址,依据真实地址访问第一存储介质或第二存储介质中的页面,内存控制器还包括第一存储介质的地址重映射表缓存。In one embodiment, the first storage medium includes an address remapping table, which is used to translate the physical address of the accessed page into a real address, and access pages in the first storage medium or the second storage medium according to the real address, and the memory controller further An address remapping table cache of the first storage medium is included.

请参考图4,为一种实施例中第一存储介质和第二存储介质分组示意图,内存控制器还用于将第一存储介质的每一个页面和第二存储介质的多个页面建立对应关系以构成一个页面交换组,并将每个所述页面交换组中热度最高的页面存储在所述第一存储介质中。例如,第一存储介质的页面1和第二存储介质的第1页面至第m页面构成第一页面交换组,内存控制器将第一页面交换组中权重值最大的页面存储在第一存储介质的页面1中。Please refer to FIG. 4 , which is a schematic diagram of grouping the first storage medium and the second storage medium in an embodiment, and the memory controller is also used to establish a corresponding relationship between each page of the first storage medium and multiple pages of the second storage medium A page exchange group is formed, and the page with the highest popularity in each page exchange group is stored in the first storage medium. For example, page 1 of the first storage medium and pages 1 to m of the second storage medium form a first page swap group, and the memory controller stores the page with the largest weight value in the first page swap group in the first storage medium page 1 of the .

一实施例中,第一存储介质是DRAM,第二存储介质是NVM。混合内存架构的内存系统包含缓存架构和平行架构。将DRAM与NVM组成统一的地址空间的平行架构,可以更好地利用DRAM与NVM的容量。所以我们采用平行架构,DRAM与NVM组成统一的地址空间,数据要么放在DRAM中,要么放在NVM中。当内存控制器获取到物理地址时,首先通过地址重映射表RT(Remap Table)将物理地址翻译为真实地址,再根据真实地址去DRAM或者NVM中获取数据。为了加快地址翻译,在内存中维护了RT的地址重映射表缓存RTC(Remap Table Cache)。每个访问都会根据访问修改判断迁移所需要的特征值,以及用于决策是否迁移的特征权重表。而每个NVM访问会根据权重表的信息决策是否进行迁移。如果要迁移进DRAM,则将该页面和被换出的DRAM页面都读取到内存控制器的交换buffer中,再分别写回DRAM和NVM。In one embodiment, the first storage medium is DRAM, and the second storage medium is NVM. A memory system with a hybrid memory architecture includes a cache architecture and a parallel architecture. A parallel architecture in which DRAM and NVM form a unified address space can better utilize the capacity of DRAM and NVM. So we adopt a parallel architecture, DRAM and NVM form a unified address space, and data is either placed in DRAM or in NVM. When the memory controller obtains the physical address, it first translates the physical address into a real address through the address remapping table RT (Remap Table), and then obtains data from DRAM or NVM according to the real address. In order to speed up address translation, RT's address remapping table cache RTC (Remap Table Cache) is maintained in memory. Each visit will judge the feature value required for migration according to the visit modification, and the feature weight table used to decide whether to migrate. Each NVM access will decide whether to migrate based on the information in the weight table. If it is to be migrated into DRAM, both the page and the swapped-out DRAM page are read into the swap buffer of the memory controller, and then written back to DRAM and NVM respectively.

地址重映射有多种方式,全相联,组相联,直接映射,全相联最为灵活,任意NVM页面都可以交换到DRAM的任意位置,但是重映射开销最大,直接映射的方式将一个DRAM页面与多个NVM页面组织为一个交换组,页面迁移只能在组内进行,任意NVM页面只能和组内唯一的DRAM页面交换,灵活性差,但是映射开销小。为了减少元数据的开销,我们采用了直接映射的方式。DRAM与NVM按1:m组成混合内存,每一个DRAM页面与m个NVM页面组成一个交换组,页面迁移只能在交换组内部进行,组内只有一个页面可以被迁移到DRAM上。整个内存空间被分为n个交换组,交换组号为1到n,物理地址模n即可得到页面的交换组号,在确定所属交换组后,查询该组的RT就可得到页面组内的位置。M=32时,需要6位来标识每一个页面的位置,所以一个交换组需要25B存储重映射信息。重映射表被放在DRAM中,如果每次内存访问,都要先访问一次DRAM,获得页面位置,再进行数据读取,将会造成大量的额外访存,大大降低性能。所以在内存控制中维护了一个重映射表的缓存RTC,只有在RTC发生miss时,才会访问DRAM获取重映射表,这样可以大大减少额外的访存。There are many ways of address remapping, full associative, group associative, and direct mapping. Full associative is the most flexible. Any NVM page can be swapped to any position in DRAM, but remapping costs the most. The direct mapping method converts a DRAM Pages and multiple NVM pages are organized into a swap group. Page migration can only be performed within the group. Any NVM page can only be swapped with the only DRAM page in the group. The flexibility is poor, but the mapping overhead is small. In order to reduce the overhead of metadata, we adopt the way of direct mapping. DRAM and NVM form a mixed memory according to 1:m. Each DRAM page and m NVM pages form a swap group. Page migration can only be performed within the swap group, and only one page in the group can be migrated to DRAM. The entire memory space is divided into n swap groups. The swap group number is from 1 to n. The physical address modulo n can get the swap group number of the page. After determining the swap group to which it belongs, query the RT of the group to get the page group number. s position. When M=32, 6 bits are needed to identify the position of each page, so a swap group needs 25B to store remapping information. The remapping table is placed in DRAM. If each memory access requires access to DRAM once to obtain the page location, and then read data, it will cause a large number of additional memory accesses and greatly reduce performance. Therefore, a cache RTC of the remapping table is maintained in the memory control. Only when the RTC miss occurs, the DRAM will be accessed to obtain the remapping table, which can greatly reduce additional memory access.

整个访存过程如下:物理地址到达内存控制器后,根据RTC中的对应项转换为真实地址,再用真实地址访问DRAM或者NVM,如果RTC发生miss,则需要访问DRAM获取对应的真实地址,再将条目插入RTC中。The entire memory access process is as follows: After the physical address reaches the memory controller, it is converted into a real address according to the corresponding item in the RTC, and then the real address is used to access DRAM or NVM. If the RTC miss occurs, it is necessary to access the DRAM to obtain the corresponding real address, and then Insert an entry into the RTC.

本申请实施例中,利用多特征的迁移算法来对热页进行预测,需要记录每个页面在不同特征值下为热页的权重,再用权重和来做出判断。本申请实施例为每个特征都维护了一张权重表,其中包括访问次数、历史访问次数和两个前序访问物理地址这四个特征(即当前被访问页面的物理地址作为下一次被访问页面的第三特征,和/或相对于当前被访问页面的前一次被访问页面的物理地址作为下一次被访问页面的第三特征),所以维护了四个权重表。我们用特征值和当前被访问页面的物理地址的异或结果,对权重表大小取模的值作为权重表的索引,索引在权重表中指向的位置即为该页面在该特征值下的权重。如果页面被访问,则增大该页面上次访问的特征对应的权重,如果页面被剔除出训练集合,则减小该页面上次访问对于特征的权重。为了修改上次访问特征的权重,我们需要记录上次访问的特征值在权重表的索引,所以热页预测单元记录的信息包括访问次数(AC)、历史访问次数(QAC)、权重值(yout)和四个特征索引值。AC记录历史访问频度,描述该页面上一次在热页预测器中AC的情况。页面被淘汰出热页预测器时,将该被剔除页面的AC值进行量子化处理,结果即为新的QAC值。四个特征索引值用来存储上一次访问该页的四个特征对应的权重表的索引。yout字段记录当前的权重和。In the embodiment of the present application, the multi-feature migration algorithm is used to predict hot pages, and it is necessary to record the weight of each page being a hot page under different feature values, and then use the sum of weights to make a judgment. The embodiment of the present application maintains a weight table for each feature, including the four features of access times, historical access times, and two previous access physical addresses (that is, the physical address of the currently accessed page is used as the next access The third characteristic of the page, and/or the physical address of the previous accessed page relative to the currently accessed page is used as the third characteristic of the next accessed page), so four weight tables are maintained. We use the XOR result of the eigenvalue and the physical address of the currently accessed page, and take the value modulo the size of the weight table as the index of the weight table, and the position pointed to by the index in the weight table is the weight of the page under the eigenvalue . If the page is visited, the weight corresponding to the feature of the last visit of the page is increased, and if the page is excluded from the training set, the weight of the feature of the last visit of the page is decreased. In order to modify the weight of the last access feature, we need to record the index of the last access feature value in the weight table, so the information recorded by the hot page prediction unit includes the number of visits (AC), the number of historical visits (QAC), the weight value (yout ) and four feature index values. AC records the historical access frequency and describes the AC status of the page in the hot page predictor last time. When a page is eliminated from the hot page predictor, the AC value of the eliminated page is quantized, and the result is a new QAC value. The four feature index values are used to store the index of the weight table corresponding to the four features of the last access to the page. The yout field records the current weight sum.

为了快速获取和更新热页预测信息,热页预测器设置在内存控制器中,热页预测单元所占用的空间如下:AC字段为一个6位的饱和计数器,记录访问次数。QAC只需要2位,记录量子化的访问次数。由于每个特征所对应的权重表大小为1024项,因此四个特征索引值字段的每个元素用10位来描述即可。由于本实施例中使用4个特征对访问页进行分析,故该字段用40个字节来维护。由于yout的绝对值设定了上限,在上限为256时,需要9位来存储yout值。如果我们设计热页预测单元的大小为1024个条目,那么总开销约为7KB。内存控制器为每一个特征都维护一个权重表,本实施例采用四个特征,所以需要在内存控制器中维护四张权重表。权重表条目记录权重值,所以每个条目需要8位,每张权重表大小为1024,所以总开销位1KB。四张权重表总开销为4KB。具体访问流程为:In order to quickly obtain and update the hot page prediction information, the hot page predictor is set in the memory controller, and the space occupied by the hot page prediction unit is as follows: the AC field is a 6-bit saturation counter, which records the number of accesses. QAC only needs 2 bits to record the number of quantized visits. Since the size of the weight table corresponding to each feature is 1024 items, each element of the four feature index value fields can be described by 10 bits. Since four features are used to analyze the accessed page in this embodiment, this field is maintained with 40 bytes. Since the absolute value of yout sets an upper limit, when the upper limit is 256, 9 bits are required to store the yout value. If we design the size of the hot page prediction unit to be 1024 entries, then the total overhead is about 7KB. The memory controller maintains a weight table for each feature. This embodiment uses four features, so four weight tables need to be maintained in the memory controller. Weight table entries record weight values, so each entry requires 8 bits, and the size of each weight table is 1024, so the total overhead is 1KB. The total overhead of the four weight tables is 4KB. The specific access process is:

到达内存控制器时,同时在RTC和TS中查找,通过RTC查找真实地址,加入到热页预测器中。对于每个访问,通过热页预测器中记录的索引更新权重表的值,同时修改几个特征的特征值,并利用新的特征值与页号进行异或,对权重表取模得到本次访问特征值在权重表上的索引值,将新的索引记录到热页预测器中,同时计算新的权重和更新到热页预测器中。如果在热页预测器中未找到该页面对应的条目,则从DRAM中获取该页的QAC值,将QAC值和新的AC值写入新建立的热页预测单元中,根据当前的特征值计算出新的索引和权重和,记录下来。新的条目插入热页预测器时,如果热页预测器已满,需要淘汰一个页面的条目,被淘汰的页面被视为热度降低,根据它记录的索引值,减小权重表中的权重值,将淘汰页面的AC值量子化为新的QAC值写回DRAM,之后删除该条目。进一步,如果被访问的页面是一个NVM页面,还需要判断是否迁移。在计算该页面的权重和时,同步计算该交换组唯一可以交换的DRAM页当前的权重和,如果该NVM页的权重和更大,则交换,否则不交换。When it arrives at the memory controller, look it up in RTC and TS at the same time, look up the real address through RTC, and add it to the hot page predictor. For each access, the value of the weight table is updated through the index recorded in the hot page predictor, and the feature values of several features are modified at the same time, and the new feature value is XORed with the page number, and the weight table is moduloed to obtain this time Access the index value of the feature value on the weight table, record the new index to the hot page predictor, and calculate the new weight and update it to the hot page predictor. If no entry corresponding to the page is found in the hot page predictor, the QAC value of the page is obtained from the DRAM, and the QAC value and the new AC value are written into the newly established hot page prediction unit, according to the current feature value Calculate the new index and weight sum and record it. When a new entry is inserted into the hot page predictor, if the hot page predictor is full, the entry of a page needs to be eliminated. The eliminated page is considered to be less popular, and the weight value in the weight table is reduced according to the index value recorded by it. , quantize the AC value of the eliminated page as a new QAC value and write it back to the DRAM, and then delete the entry. Further, if the accessed page is an NVM page, it is also necessary to determine whether to migrate. When calculating the weight sum of the page, synchronously calculate the current weight sum of the only DRAM page that can be swapped in the swap group, if the weight sum of the NVM page is greater, then swap, otherwise not swap.

基于以上所述的内存系统,请参考图5,为一种实施例中热页预测方法的流程示意图,本申请还公开了一种热页预测方法,包括:Based on the above-mentioned memory system, please refer to FIG. 5 , which is a schematic flowchart of a hot page prediction method in an embodiment. The present application also discloses a hot page prediction method, including:

步骤一,获取近期被访问页面的访问信息。In step 1, access information of recently accessed pages is obtained.

获取存储介质中近期被访问页面的访问信息,其中访问信息包括访问次数和物理地址。一实施例中,获取近期2次被访问页面的访问信息,即获取相对于当前被访问页面的前一次被访问页面的访问信息和前两次被访问页面的访问信息。一实施例中,获取近期多次被访问页面的访问信息。Obtain access information of recently accessed pages in the storage medium, where the access information includes access times and physical addresses. In one embodiment, the access information of the recently accessed pages is obtained, that is, the access information of the previously accessed page and the access information of the previous two accessed pages relative to the currently accessed page are obtained. In one embodiment, access information of recently accessed pages is obtained.

步骤二,获取当前被访问页面的访问信息。Step 2, obtaining access information of the currently accessed page.

当存储介质有页面被访问时,获取当前被访问页面的访问信息。When a page of the storage medium is accessed, the access information of the currently accessed page is obtained.

步骤三,依据访问信息获取权重值。Step 3, obtain the weight value according to the access information.

依据当前被访问页面的访问信息和近期被访问页面的访问信息,获取当前被访问页面的权重值。一实施例中,依据当前被访问页面的访问信息和前一次被访问页面的访问信息获取当前被访问页面的权重值。一实施例中,依据当前被访问页面的访问信息和前两次被访问页面的访问信息获取当前被访问页面的权重值。According to the access information of the currently accessed page and the access information of the recently accessed page, the weight value of the currently accessed page is obtained. In one embodiment, the weight value of the currently visited page is obtained according to the visit information of the currently visited page and the visit information of the previous visited page. In one embodiment, the weight value of the currently visited page is obtained according to the visit information of the currently visited page and the visit information of the previous two visited pages.

当当前被访问页面不在近期N个被访问页面中时,将当前被访问页面加入到近期N个被访问的页面中,并将当前被访问页面的访问次数设置为1,以更新近期N个被访问页面,并依据当前被访问页面的访问信息获取该当前被访问页面的权重值。一实施例中,被访问页面的权重值为第一特征权重值、第二特征权重值和/或第三特征权重值之和。When the currently visited page is not among the recent N visited pages, add the currently visited page to the recent N recently visited pages, and set the number of visits of the currently visited page to 1 to update the recent N recently visited pages Visit the page, and obtain the weight value of the currently visited page according to the visit information of the currently visited page. In an embodiment, the weight value of the accessed page is the sum of the first feature weight value, the second feature weight value and/or the third feature weight value.

请参考图6,为一种实施例中第一特征权重值的获取方法的流程示意图,第一特征权重值的获取方法包括:Please refer to FIG. 6 , which is a schematic flowchart of a method for obtaining a first feature weight value in an embodiment. The method for obtaining a first feature weight value includes:

步骤11,获取当前被访问页面的访问信息。Step 11, obtaining access information of the currently accessed page.

获取当前被访问页面的物理地址和访问次数。Obtain the physical address and access times of the currently accessed page.

步骤12,访问次数和物理地址取异或。Step 12, XOR the number of visits and the physical address.

将当前被访问页面的访问次数与当前被访问页面的物理地址取异或,以获取异或结果。XOR the access count of the currently accessed page with the physical address of the currently accessed page to obtain the XOR result.

步骤13,异或结果对第一特征权重表取模。In step 13, the XOR result is moduloed to the first feature weight table.

将步骤12的异或结果对第一特征权重表的总大小取模,以获取第一特征索引值。其中,第一特征权重表包括多个第一特征索引值和与该索引值相对应的第一特征权重值,是用于记录存储介质中任一被访问页面的访问次数与第一特征权重值的对应关系。The XOR result of step 12 is moduloed by the total size of the first feature weight table to obtain the first feature index value. Wherein, the first feature weight table includes a plurality of first feature index values and the first feature weight values corresponding to the index values, and is used to record the number of visits and the first feature weight value of any accessed page in the storage medium. corresponding relationship.

步骤14,在第一特征权重表中检索权重值。Step 14, retrieve the weight value in the first feature weight table.

从第一特征权重表中获取第一特征索引值所对应的第一特征权重值。该第一特征权重值就是该页面相对于访问次数的这个特征的权重值。The first feature weight value corresponding to the first feature index value is acquired from the first feature weight table. The weight value of the first feature is the weight value of this feature of the page relative to the number of visits.

请参考图7,为一种实施例中第二特征权重值的获取方法的流程示意图,第二特征权重值的获取方法包括:Please refer to FIG. 7 , which is a schematic flowchart of a method for obtaining a second feature weight value in an embodiment. The method for obtaining a second feature weight value includes:

步骤21,获取当前被访问页面的历史访问次数。Step 21, obtaining the historical visit times of the currently visited page.

获取当前被访问页面的历史访问次数。其中,历史访问次数是该当前访问页面上一次进入到近期N个被访问页面中时的访问次数,或是将上一次进入到近期N个被访问页面中时的访问次数进行量子化处理后的数值作为该页面的历史访问次数。存储介质中任一被访问页面的访问次数都存储在存储介质的预设的位置中,如果当前被访问页面是第一次进入近期N个被访问页面中,则该页面的历史访问次数就是0。Get the historical visit count of the currently visited page. Among them, the number of historical visits is the number of visits when the currently visited page last entered the recent N visited pages, or the number of visits when the last time it entered the recent N visited pages was quantized The value is used as the number of historical visits to this page. The number of visits of any visited page in the storage medium is stored in the preset location of the storage medium. If the currently visited page enters the recent N visited pages for the first time, the historical visit times of the page is 0 .

步骤22,历史访问次数与物理地址取异或。Step 22, XOR the historical access times and the physical address.

将当前被访问页面的历史访问次数与当前被访问页面的物理地址取异或,以获取异或结果。Exclusive OR the historical access times of the currently accessed page and the physical address of the currently accessed page to obtain the exclusive OR result.

步骤23,异或结果对第二特征权重表取模。In step 23, the XOR result is moduloed to the second feature weight table.

将步骤22的异或结果对第二特征权重表的总大小取模,以获取第二特征索引值。其中,第二特征权重表包括多个第二特征索引值和与该索引值相对应的第二特征权重值,是用于记录存储介质中任一被访问页面的历史访问次数与第二特征权重值的对应关系。The XOR result of step 22 is moduloed by the total size of the second feature weight table to obtain the second feature index value. Wherein, the second feature weight table includes a plurality of second feature index values and second feature weight values corresponding to the index values, and is used to record the historical access times and the second feature weight of any accessed page in the storage medium. value correspondence.

步骤24,在第二特征权重表中检索权重值。Step 24, retrieve the weight value in the second feature weight table.

从所述第二特征权重表中获取所述第二特征索引值所对应的第二特征权重值。该第二特征权重值就是该页面相对于历史访问次数的这个特征的权重值。Obtain the second feature weight value corresponding to the second feature index value from the second feature weight table. The weight value of the second feature is the weight value of this feature of the page relative to the number of historical visits.

请参考图8,为一种实施例中第三特征权重值的获取方法的流程示意图,第三特征权重值的获取方法包括:Please refer to FIG. 8 , which is a schematic flowchart of a method for obtaining a third feature weight value in an embodiment. The method for obtaining a third feature weight value includes:

步骤31,获取当前和之前被访问页面的物理地址。Step 31, obtaining the physical addresses of the currently and previously accessed pages.

获取当前被访问页面的物理地址,再获取之前被访问页面的物理地址。Obtain the physical address of the currently accessed page, and then obtain the physical address of the previously accessed page.

步骤32,将当前和之前的被访问页面的物理地址取异或。Step 32, XOR the physical addresses of the current and previous accessed pages.

将之前被访问页面的物理地址与当前被访问页面的物理地址取异或,以获取异或结果。一实施例中,之前被访问页面的物理地址包括前一次被访问页面的物理地址。一实施例中,之前被访问页面的物理地址包括前两次被访问页面的物理地址。XOR the physical address of the previously accessed page with the physical address of the currently accessed page to obtain the XOR result. In one embodiment, the physical address of the previously accessed page includes the physical address of the previously accessed page. In an embodiment, the physical address of the previously accessed page includes the physical addresses of the previously accessed pages twice.

步骤33,异或结果对第三特征权重表取模。In step 33, the XOR result is moduloed to the third feature weight table.

将步骤32的异或结果对第三特征权重表的总大小取模,以获取第三特征索引值。其中,第三特征权重表包括多个第三特征索引值和与该索引值相对应的第三特征权重值,是用于记录之前被访问页面的物理地址与第三特征权重值的对应关系。The XOR result of step 32 is moduloed by the total size of the third feature weight table to obtain the third feature index value. Wherein, the third feature weight table includes a plurality of third feature index values and third feature weight values corresponding to the index values, and is used to record the correspondence between the physical addresses of previously accessed pages and the third feature weight values.

步骤34,在第三特征权重表中检索权重值。Step 34, retrieve the weight value in the third feature weight table.

从第三特征权重表中获取第三特征索引值所对应的第三特征权重值。该第三特征权重值就是该页面相对于之前被访问页面的物理地址的这个特征的权重值。Obtain the third feature weight value corresponding to the third feature index value from the third feature weight table. The third characteristic weight value is the weight value of this characteristic of the page relative to the physical address of the previously accessed page.

当当前被访问页面在近期N个被访问的页面中时,将当前被访问页面的访问次数加1,并获取当前被访问页面的物理地址,以用于依据当前被访问页面的物理地址和访问次数对该当前被访问页面的权重值进行更新。其更新方法是将当前被访问页面的第一特征权重值、第二特征权重值和/或第三特征权重值进行更新。其中,第一特征权重值的更新方法包括将当前被访问页面的第一特征权重值加1,第二特征权重值的更新方法包括将当前被访问页面的第二特征权重值加1,第三特征权重值的更新方法包括将当前被访问页面的第三特征权重值加1。更新后的被访问页面的权重值为更新后的第一特征权重值、第二特征权重值和/或第三特征权重值之和。被访问说明上次访问对应特征预示着之后会被访问,所以需要增加上次访问特征的权重。三个特征的权重值在权重表中所处的位置记录在热页预测单元中的特征索引位置,根据记录的索引位置找到每张权重表上该特征的权重值,根据上述规则增加权重,即该页面在该特征下被访问可能性增加。更新了上次访问的特征对应权重值后,需要记录下本次访问的特征对应权重值的索引值,方便在下一次页面被访问或者剔除时修改这次特征对应的权重值。对于三个特征,分别用本次访问页号和特征值进行异或,异或结果对权重表大小求模,计算得到的结果即为本次访问特征的权重值在权重表中所处的位置。When the currently accessed page is among the recent N accessed pages, add 1 to the number of visits of the currently accessed page, and obtain the physical address of the currently accessed page, which is used to base the physical address and access of the currently accessed page The number of times to update the weight value of the currently visited page. The update method is to update the first feature weight value, the second feature weight value and/or the third feature weight value of the currently accessed page. Wherein, the update method of the first feature weight value includes adding 1 to the first feature weight value of the currently accessed page, the update method of the second feature weight value includes adding 1 to the second feature weight value of the currently accessed page, and the third The method for updating the feature weight value includes adding 1 to the third feature weight value of the currently accessed page. The updated weight value of the accessed page is the sum of the updated first feature weight value, second feature weight value and/or third feature weight value. Being visited indicates that the corresponding feature of the last visit indicates that it will be visited later, so the weight of the last visit feature needs to be increased. The position of the weight value of the three features in the weight table is recorded in the feature index position in the hot page prediction unit, and the weight value of the feature on each weight table is found according to the recorded index position, and the weight is increased according to the above rules, namely The page is more likely to be visited under this feature. After updating the weight value corresponding to the feature of the last visit, you need to record the index value of the weight value corresponding to the feature of this visit, so that you can modify the weight value corresponding to this feature when the next page is accessed or deleted. For the three features, XOR is performed with the page number and feature value of this visit, and the XOR result is modulo the size of the weight table, and the calculated result is the position of the weight value of the feature of this visit in the weight table .

当当前被访问页面不在近期N个被访问页面中时,应用最近最少使用算法在近期N个被访问页面中剔除一个页面,并将当前被访问页面加入到近期N个被访问页面中,并记录该被剔除页面的访问次数作为该页面下一次进入近期N个被访问页面中时的历史访问次数。或对被剔除页面的访问次数进行量子化处理,再记录进行量子化处理后的结果,以作为被剔除页面下一次进入近期N个被访问页面中时的历史访问次数。一实施例中,按以下规则对被剔除页面的访问次数进行量子化处理:When the currently visited page is not among the recently visited pages, apply the least recently used algorithm to remove a page from the recently visited pages, and add the currently visited page to the recently visited pages, and record The number of visits of the excluded page is used as the historical number of visits when the page next enters the recent N visited pages. Or perform quantization on the number of visits of the removed page, and then record the result of the quantization as the historical number of visits when the removed page enters the recent N visited pages next time. In one embodiment, the number of accesses to the excluded pages is quantized according to the following rules:

当访问次数是0时,则量子化的结果为0;When the number of visits is 0, the result of quantization is 0;

当访问次数是1至8时,则量子化的结果为1;When the number of visits is 1 to 8, the result of quantization is 1;

当访问次数是9至31时,则量子化的结果为2;When the number of visits is 9 to 31, the result of quantization is 2;

当访问次数大于31时,则量子化的结果为3。When the number of visits is greater than 31, the result of quantization is 3.

页面被剔除说明对应页面访问热度不够,需要减小权重。和被访问相似,根据热页预测单元中记录的上次访问特征的权重表索引找到权重值,按照上述规则减小权重,就表示该页面上次的访问特征可能预示着该页面热度下降。修改完四个权重表的值之后,该条目将该页面剔除出热页预测器,需要将本轮的AC值量子化后写回DRAM。The removal of a page indicates that the corresponding page is not popular enough, and the weight needs to be reduced. Similar to being visited, the weight value is found according to the weight table index of the last access feature recorded in the hot page prediction unit, and the weight is reduced according to the above rules, which means that the last access feature of the page may indicate that the popularity of the page has declined. After modifying the values of the four weight tables, the entry excludes the page from the hot page predictor, and needs to quantize the AC value of the current round and write it back to DRAM.

一实施例中,当当前被访问页面的权重值大于一预设值时,就不对当前被访问页面的权重值进行更新。当权重值增加到一定阈值时不能再继续增加,以保证程序访问模式发生变化时,权重值能更快地反应变化情况。考虑这种情况:假设不做限制,当某页在第一个阶段热度非常高时,经过一段时间,权重值会变得很大;当下一个阶段来临时,该页骤然变冷,很少再被访问。此时需要很长时间对权重值进行调整,不断减小,在这段时间,由于权重值过大,热页预测器很可能出现误判,对本该冷却的页进行迁移。所以需要给权重值设定范围,使得当应用访存阶段发生明显变化时,能够快速收敛。In one embodiment, when the weight value of the currently accessed page is greater than a preset value, the weight value of the currently accessed page is not updated. When the weight value increases to a certain threshold, it cannot continue to increase, so as to ensure that when the program access mode changes, the weight value can respond to the change situation more quickly. Consider this situation: Assuming no restrictions, when a page is very popular in the first stage, after a period of time, the weight value will become very large; when the next stage comes, the page suddenly becomes cold, and rarely is visited. At this time, it takes a long time to adjust the weight value and keep reducing it. During this period, due to the excessive weight value, the hot page predictor may make a misjudgment and migrate the page that should be cooled. Therefore, it is necessary to set a range for the weight value so that when the application memory access stage changes significantly, it can quickly converge.

本申请实施例中,提出了一种基于多特征的混合存储数据迁移方法,选择了四种特征来进行热页预测,并应用感知机学习的方法来融合可能反映数据热度的多个特征并行预测。感知机是二分类的线性模型,其输入是实例的特征向量,输出的是实例的类别。为了利用多个特征对结果进行预测,将多个特征组成一个特征向量,特征向量与对应权重的点积结果yout即为预测结果,如果点积结果超过了阈值,那么预测结果为真,否则为假,训练即为更新权重的过程。如果预测结果为真,且权重值未超过上限,则增加权重值,如果预测结果为假,则减小权重值。经过训练,权重值将反映出在这个特征下预测结果为真的概率。在热页预测中,如果热页被访问,则表示预测它是热页结果为真,权重值增加,如果被剔除,说明它不是热页,预测结果为假,减小特征对应权重值。此时权重值越大,意味着拥有这个特征的页面越可能是个热页。为了减小开销,计算预测结果时不再使用点积进行计算,而是用特征来索引权重表,再将索引的权重和作为预测结果的方式来替代。对于每个NVM访问,都会判断该页面是否需要进行迁移。由于每次访问的特征预示着下次访问情况,所以判断该NVM页将来是否为热页,只需要根据当前访问的特征进行判断。将本次访问的特征对应的权重值相加得到权重和,如果权重和超过阈值,则判定为热页并进行迁移。In the embodiment of this application, a hybrid storage data migration method based on multi-features is proposed, and four kinds of features are selected for hot page prediction, and the method of perceptron learning is applied to fuse multiple features that may reflect data popularity for parallel prediction . The perceptron is a linear model of binary classification, its input is the feature vector of the instance, and the output is the category of the instance. In order to use multiple features to predict the result, multiple features are combined into a feature vector. The dot product result yout of the feature vector and the corresponding weight is the prediction result. If the dot product result exceeds the threshold, the prediction result is true, otherwise it is False, training is the process of updating weights. If the prediction is true and the weight value does not exceed the upper limit, increase the weight value, and if the prediction is false, decrease the weight value. After training, the weight value will reflect the probability that the predicted result is true under this feature. In the hot page prediction, if the hot page is accessed, it means that the result of predicting it is a hot page is true, and the weight value is increased. If it is eliminated, it means that it is not a hot page, and the prediction result is false, and the corresponding weight value of the feature is reduced. At this point, the larger the weight value, the more likely the page with this feature is to be a hot page. In order to reduce the overhead, the dot product is no longer used to calculate the prediction result, but the feature is used to index the weight table, and then the weight sum of the index is used as the prediction result instead. For each NVM access, it is determined whether the page needs to be migrated. Since the characteristics of each access indicate the next access situation, judging whether the NVM page will be a hot page in the future only needs to be judged according to the characteristics of the current access. Add the weight values corresponding to the features of this visit to get the weight sum. If the weight sum exceeds the threshold, it will be determined as a hot page and migrated.

和现有技术的MDM热页预测方法相比,本申请公开的方法考虑了更多反映页面热度的特征,可以更准确进行热页预测。Compared with the MDM hot page prediction method in the prior art, the method disclosed in the present application considers more features reflecting the popularity of the page, and can perform hot page prediction more accurately.

请参考图9和图10,为与MDM算法比较DRAM访问率的对比示意图和NVM写数量的对比示意图,其中图9的纵坐标为DRAM访问率,图10的纵坐标为NVM写数量,分别表示为本申请实施例中公开的方法与MDM算法比较的DRAM访问率及NVM写数量的对比。在gem5和NVMain上实现了以上算法,利用SPEC2006的benchmark来进行测试,与现有性能最优的MDM迁移算法进行对比。通过比较了MDM与mfHMM在DRAM访问比例和NVM写数量上的差异。发现mfHMM能将更多的热页迁移到DRAM上,增加DRAM访问的比例,同时减少了NVM的访问次数。请参考图11,为不同权重表下DRAM访问率对比示意图,其中纵坐标为DRAM访问率。可以看出增大权重表大小,可以提升预测的准确度,图中分别表示为权重表大小为1024、2048和4096。只增加了不到12KB的开销,将DRAM访问率平均提升7.07%,将NVM写入平均减少20.57%。Please refer to Figure 9 and Figure 10, which are a comparison diagram of the DRAM access rate and a comparison diagram of the NVM write quantity compared with the MDM algorithm, where the vertical axis of Figure 9 is the DRAM access rate, and the vertical axis of Figure 10 is the NVM write quantity, respectively. It is a comparison of DRAM access rate and NVM write quantity between the method disclosed in the embodiment of this application and the MDM algorithm. The above algorithm was implemented on gem5 and NVMain, tested using the benchmark of SPEC2006, and compared with the existing MDM migration algorithm with the best performance. By comparing the difference between MDM and mfHMM in DRAM access ratio and NVM write quantity. It is found that mfHMM can migrate more hot pages to DRAM, increase the proportion of DRAM access, and reduce the number of NVM access. Please refer to FIG. 11 , which is a schematic diagram of a comparison of DRAM access rates under different weight tables, where the ordinate is the DRAM access rate. It can be seen that increasing the size of the weight table can improve the accuracy of the prediction. The figures show that the weight table sizes are 1024, 2048, and 4096, respectively. Only adding less than 12KB of overhead, the DRAM access rate is increased by an average of 7.07%, and the NVM write is reduced by an average of 20.57%.

实施例二:Embodiment two:

请参考图12,另一种实施例中基于混合内存架构的页面调度方法流程示意图,其中混合内存包括第一存储介质和第二存储介质,第一存储介质的访问延迟小于第二存储介质的访问延迟,该方法包括:Please refer to FIG. 12 , which is a schematic flowchart of a paging method based on a hybrid memory architecture in another embodiment, wherein the hybrid memory includes a first storage medium and a second storage medium, and the access delay of the first storage medium is less than that of the second storage medium Delay, the method includes:

步骤壹,对被访问页面进行热页预测。Step 1, perform hot page prediction on the visited page.

依据实施例一种所述的热页预测方法对第一存储介质和第二存储介质中被访问页面进行热页预测。According to the hot page prediction method described in one of the embodiments, hot page prediction is performed on accessed pages in the first storage medium and the second storage medium.

步骤贰,调度页面。Step 2, schedule the page.

将近期N个被访问页面中权重值高的被访问页面放置于第一存储介质。一实施例中,第一存储介质是DRAM,第二存储介质是NVM。An accessed page with a higher weight value among the recent N accessed pages is placed in the first storage medium. In one embodiment, the first storage medium is DRAM, and the second storage medium is NVM.

一实施例中,将近期N个被访问页面中权重值高的被访问页面放置于第一存储介质时,先将第一存储介质的每一个页面和第二存储介质的多个页面建立对应关系以构成一个页面交换组,再将每个页面交换组中权重值最高的页面存储在第一存储介质中。In one embodiment, when placing an accessed page with a high weight value among the recent N accessed pages on the first storage medium, first establish a corresponding relationship between each page of the first storage medium and multiple pages of the second storage medium A page exchange group is formed, and the page with the highest weight value in each page exchange group is stored in the first storage medium.

本领域技术人员可以理解,上述实施方式中各种方法的全部或部分功能可以通过硬件的方式实现,也可以通过计算机程序的方式实现。当上述实施方式中全部或部分功能通过计算机程序的方式实现时,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:只读存储器、随机存储器、磁盘、光盘、硬盘等,通过计算机执行该程序以实现上述功能。例如,将程序存储在设备的存储器中,当通过处理器执行存储器中程序,即可实现上述全部或部分功能。另外,当上述实施方式中全部或部分功能通过计算机程序的方式实现时,该程序也可以存储在服务器、另一计算机、磁盘、光盘、闪存盘或移动硬盘等存储介质中,通过下载或复制保存到本地设备的存储器中,或对本地设备的系统进行版本更新,当通过处理器执行存储器中的程序时,即可实现上述实施方式中全部或部分功能。Those skilled in the art can understand that all or part of the functions of the various methods in the foregoing implementation manners can be realized by means of hardware, or by means of computer programs. When all or part of the functions in the above embodiments are implemented by means of a computer program, the program can be stored in a computer-readable storage medium, and the storage medium can include: read-only memory, random access memory, magnetic disk, optical disk, hard disk, etc., through The computer executes the program to realize the above-mentioned functions. For example, the program is stored in the memory of the device, and when the processor executes the program in the memory, all or part of the above-mentioned functions can be realized. In addition, when all or part of the functions in the above embodiments are realized by means of a computer program, the program can also be stored in a storage medium such as a server, another computer, a magnetic disk, an optical disk, a flash disk, or a mobile hard disk, and saved by downloading or copying. To the memory of the local device, or to update the version of the system of the local device, when the processor executes the program in the memory, all or part of the functions in the above embodiments can be realized.

以上应用了具体个例对本发明进行阐述,只是用于帮助理解本发明,并不用以限制本发明。对于本发明所属技术领域的技术人员,依据本发明的思想,还可以做出若干简单推演、变形或替换。The above uses specific examples to illustrate the present invention, which is only used to help understand the present invention, and is not intended to limit the present invention. For those skilled in the technical field to which the present invention belongs, some simple deduction, deformation or replacement can also be made according to the idea of the present invention.

Claims (8)

1.一种存储介质的热页预测方法,其特征在于,包括:1. A method for predicting hot pages of a storage medium, comprising: 获取所述存储介质中近期N个被访问页面的访问信息,其中所述访问信息包括访问次数和物理地址;Acquiring access information of recently N accessed pages in the storage medium, wherein the access information includes access times and physical addresses; 当存储介质有页面被访问时,依据当前被访问页面的访问信息和所述近期N个被访问页面的访问信息,获取当前被访问页面的权重值;When a page is accessed in the storage medium, the weight value of the currently accessed page is obtained according to the access information of the currently accessed page and the access information of the recent N accessed pages; 依据被访问页面的权重值对该被访问页面进行热页预测;Predict the hot page of the visited page according to the weight value of the visited page; 所述当存储介质有页面被访问时,依据当前被访问页面的访问信息和所述近期N个被访问页面的访问信息,获取当前被访问页面的权重值,包括:When the storage medium has a page accessed, according to the access information of the currently accessed page and the access information of the recent N accessed pages, the weight value of the currently accessed page is obtained, including: 当当前被访问页面不在所述近期N个被访问页面中时,将当前被访问页面加入到所述近期N个被访问的页面中,并将当前被访问页面的访问次数设置为1,以更新所述近期N个被访问页面;依据当前被访问页面的访问信息获取该当前被访问页面的权重值;When the currently visited page is not in the recent N visited pages, the currently visited page is added to the recently visited N pages, and the number of visits of the currently visited page is set to 1 to update The recent N visited pages; obtaining the weight value of the currently visited page according to the access information of the currently visited page; 当当前被访问页面在所述近期N个被访问的页面中时,将当前被访问页面的访问次数加1;获取当前被访问页面的物理地址;依据当前被访问页面的物理地址和访问次数对该当前被访问页面的权重值进行更新;When the currently accessed page is in the recently N accessed pages, add 1 to the number of visits of the currently accessed page; obtain the physical address of the currently accessed page; The weight value of the currently visited page is updated; 所述被访问页面的权重值为第一特征权重值、第二特征权重值和/或第三特征权重值之和;The weight value of the accessed page is the sum of the first feature weight value, the second feature weight value and/or the third feature weight value; 所述第一特征权重值的获取方法包括:The method for obtaining the first feature weight value includes: 获取当前被访问页面的物理地址;Obtain the physical address of the currently accessed page; 将当前被访问页面的访问次数与当前被访问页面的物理地址取异或,以获取异或结果;XOR the access times of the currently accessed page with the physical address of the currently accessed page to obtain the XOR result; 将所述异或结果对第一特征权重表的总大小取模,以获取第一特征索引值;Taking the XOR result modulo the total size of the first feature weight table to obtain the first feature index value; 所述第一特征权重表包括多个第一特征索引值和与该索引值相对应的第一特征权重值,是用于记录所述存储介质中任一被访问页面的访问次数与第一特征权重值的对应关系;The first feature weight table includes a plurality of first feature index values and first feature weight values corresponding to the index values, and is used to record the number of visits of any accessed page in the storage medium and the first feature weight value. Correspondence of weight values; 从所述第一特征权重表中获取所述第一特征索引值所对应的第一特征权重值;Acquiring a first feature weight value corresponding to the first feature index value from the first feature weight table; 所述第二特征权重值的获取方法包括:The method for obtaining the second feature weight value includes: 获取当前被访问页面的历史访问次数;Obtain the number of historical visits of the currently visited page; 将当前被访问页面的历史访问次数与当前被访问页面的物理地址取异或,以获取异或结果;XOR the historical access times of the currently accessed page with the physical address of the currently accessed page to obtain the XOR result; 将所述异或结果对第二特征权重表的总大小取模,以获取第二特征索引值;taking the XOR result modulo the total size of the second feature weight table to obtain a second feature index value; 所述第二特征权重表包括多个第二特征索引值和与该索引值相对应的第二特征权重值,是用于记录所述存储介质中任一被访问页面的历史访问次数与第二特征权重值的对应关系;The second feature weight table includes a plurality of second feature index values and second feature weight values corresponding to the index values, and is used to record the historical access times of any accessed page in the storage medium and the second Correspondence of feature weight values; 从所述第二特征权重表中获取所述第二特征索引值所对应的第二特征权重值;acquiring a second feature weight value corresponding to the second feature index value from the second feature weight table; 所述第三特征权重值的获取方法包括:The method for obtaining the third feature weight value includes: 获取当前被访问页面的物理地址;Obtain the physical address of the currently accessed page; 获取之前被访问页面的物理地址;Obtain the physical address of the previously accessed page; 将之前被访问页面的物理地址与当前被访问页面的物理地址取异或,以获取异或结果;XOR the physical address of the previously accessed page with the physical address of the currently accessed page to obtain the XOR result; 将所述异或结果对第三特征权重表的总大小取模,以获取第三特征索引值;taking the XOR result modulo the total size of the third feature weight table to obtain a third feature index value; 所述第三特征权重表包括多个第三特征索引值和与该索引值相对应的第三特征权重值,是用于记录之前被访问页面的物理地址与第三特征权重值的对应关系;The third feature weight table includes a plurality of third feature index values and third feature weight values corresponding to the index values, and is used to record the correspondence between the physical address of the previously accessed page and the third feature weight value; 从所述第三特征权重表中获取所述第三特征索引值所对应的第三特征权重值。Obtain a third feature weight value corresponding to the third feature index value from the third feature weight table. 2.如权利要求1所述的热页预测方法,其特征在于,所述更新所述近期N个被访问页面还包括:2. The hot page prediction method according to claim 1, wherein said updating said recent N visited pages further comprises: 当当前被访问页面不在所述近期N个被访问页面中时,应用最近最少使用算法在所述近期N个被访问页面中剔除一个页面,并将当前被访问页面加入到所述近期N个被访问页面中;When the currently accessed page is not among the recently N accessed pages, apply the least recently used algorithm to remove a page from the recently N accessed pages, and add the currently accessed page to the recently N accessed pages access page; 记录被剔除页面的访问次数作为该页面下一次进入所述近期N个被访问页面中时的历史访问次数。The number of visits of the removed page is recorded as the historical number of visits when the page next enters the recent N visited pages. 3.如权利要求2所述的热页预测方法,其特征在于,所述记录该被剔除页面的访问次数作为该页面下一次进入所述近期N个被访问页面中时的历史访问次数,包括:3. The method for predicting hot pages as claimed in claim 2, wherein the recording of the number of visits of the rejected page is used as the historical number of visits when the page enters the N recently visited pages next time, including : 对所述被剔除页面的访问次数进行量子化处理;Quantize the number of visits to the excluded pages; 记录进行量子化处理后的结果,以作为所述被剔除页面下一次进入所述近期N个被访问页面中时的历史访问次数;Recording the result after quantization processing as the historical access times when the rejected page enters the recent N accessed pages next time; 按以下规则对所述访问次数进行量子化处理:Quantize the access times according to the following rules: 当访问次数是0时,则量子化的结果为0;When the number of visits is 0, the result of quantization is 0; 当访问次数是1至8时,则量子化的结果为1;When the number of visits is 1 to 8, the result of quantization is 1; 当访问次数是9至31时,则量子化的结果为2;When the number of visits is 9 to 31, the result of quantization is 2; 当访问次数大于31时,则量子化的结果为3。When the number of visits is greater than 31, the result of quantization is 3. 4.如权利要求1所述的热页预测方法,其特征在于,所述之前被访问页面的物理地址包括前一次被访问页面的物理地址或前两次被访问页面的物理地址。4. The hot page prediction method according to claim 1, wherein the physical address of the previously accessed page comprises the physical address of the previously accessed page or the physical addresses of the previously accessed pages twice. 5.如权利要求1所述的热页预测方法,其特征在于,所述依据当前被访问页面的物理地址和访问次数对该当前被访问页面的权重值进行更新,包括:5. The hot page prediction method according to claim 1, wherein said updating the weight value of the currently accessed page according to the physical address of the currently accessed page and the number of visits includes: 将当前被访问页面的第一特征权重值、第二特征权重值和/或第三特征权重值进行更新;updating the first feature weight value, the second feature weight value and/or the third feature weight value of the currently accessed page; 所述第一特征权重值的更新方法包括:The update method of the first feature weight value includes: 将当前被访问页面的第一特征权重值加1;Add 1 to the first feature weight value of the currently visited page; 所述第二特征权重值的更新方法包括:The update method of the second feature weight value includes: 将当前被访问页面的第二特征权重值加1;Add 1 to the second feature weight value of the currently visited page; 所述第三特征权重值的更新方法包括:The update method of the third feature weight value includes: 将当前被访问页面的第三特征权重值加1;Add 1 to the weight value of the third feature of the currently visited page; 更新后的被访问页面的权重值为更新后的第一特征权重值、第二特征权重值和/或第三特征权重值之和。The updated weight value of the accessed page is the sum of the updated first feature weight value, second feature weight value and/or third feature weight value. 6.如权利要求5所述的热页预测方法,其特征在于,还包括:6. The hot page prediction method according to claim 5, further comprising: 当所述当前被访问页面的权重值大于一预设值时,不对所述当前被访问页面的权重值进行更新。When the weight value of the currently accessed page is greater than a preset value, the weight value of the currently accessed page is not updated. 7.一种基于混合内存架构的页面调度方法,其特征在于,所述混合内存包括第一存储介质和第二存储介质,所述第一存储介质的访问延迟小于第二存储介质的访问延迟;所述方法包括:7. A paging method based on a hybrid memory architecture, wherein the hybrid memory includes a first storage medium and a second storage medium, and the access delay of the first storage medium is less than the access delay of the second storage medium; The methods include: 依据如权利要求1至6任一项所述的热页预测方法对所述第一存储介质和第二存储介质中被访问页面进行热页预测;performing hot page prediction on the accessed pages in the first storage medium and the second storage medium according to the hot page prediction method according to any one of claims 1 to 6; 将所述近期N个被访问页面中权重值高的被访问页面放置于第一存储介质。Place the accessed page with a higher weight value among the recent N accessed pages in the first storage medium. 8.如权利要求7所述的页面调度方法,其特征在于,所述将所述近期N个被访问页面中权重值高的被访问页面放置于第一存储介质,包括:8. The paging method according to claim 7, wherein the placing the accessed page with a high weight value among the recent N accessed pages on the first storage medium comprises: 将第一存储介质的每一个页面和第二存储介质的多个页面建立对应关系以构成一个页面交换组;Establishing a corresponding relationship between each page of the first storage medium and multiple pages of the second storage medium to form a page exchange group; 将每个所述页面交换组中权重值最高的页面存储在第一存储介质中。The page with the highest weight value in each page exchange group is stored in the first storage medium.
CN201910791493.8A 2019-08-26 2019-08-26 Hot page prediction method and paging method for storage medium Active CN110795363B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910791493.8A CN110795363B (en) 2019-08-26 2019-08-26 Hot page prediction method and paging method for storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910791493.8A CN110795363B (en) 2019-08-26 2019-08-26 Hot page prediction method and paging method for storage medium

Publications (2)

Publication Number Publication Date
CN110795363A CN110795363A (en) 2020-02-14
CN110795363B true CN110795363B (en) 2023-05-23

Family

ID=69427051

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910791493.8A Active CN110795363B (en) 2019-08-26 2019-08-26 Hot page prediction method and paging method for storage medium

Country Status (1)

Country Link
CN (1) CN110795363B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114253458B (en) * 2020-09-21 2024-04-26 华为技术有限公司 Memory page fault exception processing method, device, equipment and storage medium
CN112214302B (en) * 2020-10-30 2023-07-21 中国科学院计算技术研究所 Process scheduling method
CN113282585B (en) * 2021-05-28 2023-12-29 浪潮通用软件有限公司 Report calculation method, device, equipment and medium
CN114116528B (en) * 2021-11-22 2022-11-11 深圳大学 A memory access address prediction method, device, storage medium and electronic device
CN114153545B (en) * 2021-12-09 2024-10-15 深圳市华锴信息技术有限公司 Multi-page-based management system and method
CN118732931A (en) * 2023-03-31 2024-10-01 华为技术有限公司 Memory data migration method and related equipment
CN119621605A (en) * 2023-09-13 2025-03-14 华为技术有限公司 Method, device, equipment, chip and processor for determining heat of memory page

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105659212A (en) * 2013-08-22 2016-06-08 格罗方德股份有限公司 Detection of hot pages for partition hibernation
CN106709068A (en) * 2017-01-22 2017-05-24 郑州云海信息技术有限公司 Hotspot data identification method and device
CN107193646A (en) * 2017-05-24 2017-09-22 中国人民解放军理工大学 A kind of high-efficiency dynamic paging method that framework is hosted based on mixing

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9330026B2 (en) * 2013-03-05 2016-05-03 Qualcomm Incorporated Method and apparatus for preventing unauthorized access to contents of a register under certain conditions when performing a hardware table walk (HWTW)
CN105786717B (en) * 2016-03-22 2018-11-16 华中科技大学 The DRAM-NVM stratification isomery memory pool access method and system of software-hardware synergism management

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105659212A (en) * 2013-08-22 2016-06-08 格罗方德股份有限公司 Detection of hot pages for partition hibernation
CN106709068A (en) * 2017-01-22 2017-05-24 郑州云海信息技术有限公司 Hotspot data identification method and device
CN107193646A (en) * 2017-05-24 2017-09-22 中国人民解放军理工大学 A kind of high-efficiency dynamic paging method that framework is hosted based on mixing

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
陈俊熹 ; 沙行勉 ; 诸葛晴凤 ; 陈咸彰 ; .混合内存页面管理策略的性能和能耗研究.现代计算机(专业版).2017,(11),全文. *

Also Published As

Publication number Publication date
CN110795363A (en) 2020-02-14

Similar Documents

Publication Publication Date Title
CN110795363B (en) Hot page prediction method and paging method for storage medium
CN110532200B (en) A memory system based on hybrid memory architecture
CN107193646B (en) An efficient dynamic paging method based on hybrid main memory architecture
JP6613375B2 (en) Profiling cache replacement
CN103885728B (en) A kind of disk buffering system based on solid-state disk
CN102760101B (en) SSD-based (Solid State Disk) cache management method and system
CN104834607B (en) A kind of hit rate for improving distributed caching and the method for reducing solid state hard disc abrasion
US9971698B2 (en) Using access-frequency hierarchy for selection of eviction destination
CN104699424B (en) A kind of isomery EMS memory management process based on page temperature
CN108845957B (en) A permutation and write-back adaptive buffer management method
CN106775476A (en) Mixing memory system and its management method
CN107247675B (en) A cache selection method and system based on classification prediction
CN103019955B (en) The EMS memory management process of PCR-based AM main memory application
CN104503703B (en) The treating method and apparatus of caching
CN103345368B (en) Data caching method in buffer storage
CN110888600A (en) A buffer management method for NAND flash memory
CN106933516A (en) A kind of storage controlling method and device of the storage system of blending agent
CN109002400B (en) Content-aware computer cache management system and method
CN108710581A (en) Bloom filter-based PCM storage medium wear leveling method
KR101105127B1 (en) Buffer Cache Management Method using SSD Extended Buffer and Device Using SSD as Extended Buffer
CN105359116B (en) Buffer, shared cache management method and controller
CN118819427A (en) Multi-level intelligent cache system and cache data processing method and program product
CN106708750B (en) Cache read-ahead method and system for storage system
CN115827511A (en) Method and device for setting cache
CN115048056A (en) Solid state disk buffer area management method based on page replacement cost

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant