CN111580754A - Write-friendly flash memory solid-state disk cache management method - Google Patents

Write-friendly flash memory solid-state disk cache management method Download PDF

Info

Publication number
CN111580754A
CN111580754A CN202010374302.0A CN202010374302A CN111580754A CN 111580754 A CN111580754 A CN 111580754A CN 202010374302 A CN202010374302 A CN 202010374302A CN 111580754 A CN111580754 A CN 111580754A
Authority
CN
China
Prior art keywords
page
cache
data
linked list
flash memory
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.)
Granted
Application number
CN202010374302.0A
Other languages
Chinese (zh)
Other versions
CN111580754B (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.)
Xian Jiaotong University
Original Assignee
Xian Jiaotong University
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 Xian Jiaotong University filed Critical Xian Jiaotong University
Priority to CN202010374302.0A priority Critical patent/CN111580754B/en
Publication of CN111580754A publication Critical patent/CN111580754A/en
Application granted granted Critical
Publication of CN111580754B publication Critical patent/CN111580754B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • 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
    • G06F12/0238Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
    • G06F12/0246Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory
    • 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
    • G06F12/0253Garbage collection, i.e. reclamation of unreferenced memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Landscapes

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

Abstract

The invention discloses a write-friendly flash memory solid-state disk cache management method, which takes a page as a basic unit to manage a clean data page in a cache, carries out page cluster operation on a dirty data page in the cache according to different flash memory physical blocks to which the dirty data page belongs, and organizes a plurality of data pages of the same flash memory physical block into one page cluster; setting system access time visit _ time to record the times of accessing a data page; recording the time mark of the cache access data page; setting a recent access time window; the latest access time window covers a plurality of data pages which are accessed recently in the cache, the value tw of the latest access time window is set to be 10% of the size of the cache space, when the target data of the I/O request is not hit in the cache, the target data of the I/O request is read from the flash memory and returned to the upper application, and then the target data pages are inserted into corresponding management linked lists in the cache according to the read-write type of the I/O request. The cache replacement times and the flash memory garbage recycling overhead are reduced, and the overall performance of the flash memory is improved.

Description

Write-friendly flash memory solid-state disk cache management method
Technical Field
The invention belongs to the technical field of cache, and particularly relates to a write-friendly flash memory solid-state disk cache management method.
Background
The solid-state disk of the flash memory has the advantages of high access speed, low energy consumption, good shock resistance and the like, is widely concerned and researched in the industrial and academic fields, and is widely applied to consumer equipment, cloud storage and data centers. However, due to the physical characteristics of flash memory, flash solid-state disks face many constraints such as erasing before writing, asymmetry of reading and writing, and limited erasing times. In order to avoid data block erasure and data migration caused by update write operation, the flash memory uses a remote update strategy to redirect the update write operation to the reallocated free block, thereby avoiding the erase operation and data migration of the data block in each write operation and shortening the response time of the I/O request. However, as the I/O request proceeds, the remote update mechanism causes a large amount of invalid data to appear in the data block in the flash memory, and when the storage space of the flash memory is consumed, a garbage collection operation is required to recover the flash memory space occupied by the invalid data pages. Frequent garbage collection will seriously affect the storage performance of the flash memory solid-state disk.
To reduce the impact of frequent write operations on flash memory performance, flash-based cache replacement algorithms typically reduce the number of write operations to flash memory from a policy that preferentially replaces cold clean pages in the cache. Meanwhile, due to the influence of the flash memory remote updating strategy, the data layout of the flash memory also influences the garbage recovery frequency and the overhead of the flash memory. How to write data with different cold and hot characteristics back to the flash memory more reasonably should also be a factor that should be considered by the cache replacement algorithm based on the flash memory.
Disclosure of Invention
The invention aims to solve the technical problem that the existing flash memory solid-state disk cache management method is not enough in the aspect of optimizing write operation, and provides a write-friendly flash memory solid-state disk cache management method.
The invention adopts the following technical scheme:
a write-friendly flash memory solid-state disk cache management method comprises the following steps:
s1, managing clean data pages in the cache by taking the pages as basic units, carrying out page cluster operation on dirty data pages in the cache according to different flash memory physical blocks to which the dirty data pages belong, and organizing a plurality of data pages belonging to the same flash memory physical block into one page cluster;
s2, setting system access time visit _ time to record the times of accessing the data page, setting the initial value of the time visit _ time to be 0, and recording the time mark of caching the access data page;
s3, setting a latest access time window tw to indicate the range of data pages which are not replaced in a protection cache when cache replacement operation occurs, and covering a plurality of data pages which are accessed recently in the cache by using the latest access time window tw;
s4, after receiving the target data page of the upper layer application I/O request, the flash memory solid state disk firstly judges whether the target data page is hit in the cache, if so, the step S5 is executed; if not, go to step S6;
s5, after the hit in the cache, returning the target page to the upper application program, and adjusting the target page to the corresponding MRU end of the hot link table;
s6, if the I/O request is not hit in the cache, reading the target data of the I/O request from the flash memory and returning the target data to the upper application, inserting the data into the corresponding cache management linked list, if the cache has a free space to satisfy the target data page for storing the I/O request, executing the step S8, and if the cache does not satisfy the free space, executing the step S7;
s7, when there is not enough free space in the cache to store the target data page of the I/O request, executing a cache replacement algorithm and then executing supplement S8;
s8, when the target data of the I/O request is not hit in the cache, the target data of the I/O request is read from the flash memory and returned to the upper application, and then the target data page is inserted into the corresponding management linked list in the cache according to the read-write type of the I/O request, so as to realize cache management.
Specifically, in step S1, the cold link table and the hot link table are used to manage clean data pages in the cache, where the cold link table is used to manage clean data pages that have been accessed only once in the cache, and the hot link table is used to manage clean data pages that have been hit in the cache, that is, clean data pages that have been accessed twice or more; the dirty data page clusters in the cache are managed by adopting a cold block linked list and a hot block linked list, the cold block linked list is used for managing page clusters of dirty data page aggregation which are accessed only once, and the hot block linked list is used for managing page clusters of dirty data page aggregation which are hit in the cache.
Specifically, in step S2, when the user I/O request comes, every time a data page is accessed, the visit _ time value performs an add-1 operation, and meanwhile, the current visit _ time value is assigned to the page _ time of the accessed data page, and the access time stamp of the currently accessed data is recorded.
Specifically, in step S3, the value tw of the latest access time window is set to be 10% to 50% of the size of the cache space, and the data page in the cache is regarded as a logical LRU linked list according to the sequence of the access time stamp values, and the latest access time window is the data page within the range of tw of the MRU end of the logical LRU linked list.
Further, a data page P is judgediThe basis for whether it is within the last access time window is: calculating current system access time stamp value and data page PiAccess time stamp value PiWhether the difference value of _ page _ time is greater than the latest access time window value tw, if the calculated difference value is greater than the latest access time window value tw, the data page PiNot within the most recent access time window; otherwise, data page PiWithin the most recent access time window; when a data page is judged to be in the latest access time window, the data page is the data page which is accessed recently, the time for the data page to reside in the cache is given, and the data page is protected from being replaced out of the cache.
Specifically, step S5 specifically includes:
s501, judging whether the I/O request is a read request and whether a hit target page is a clean page, if so, executing a step S502, and if not, executing a step S503;
s502, adjusting the target page from the current position to the end of the hot link table MRU, updating the target page information and the hot link table, and finishing adjustment;
s503, adjusting the target page from the current position to the MRU end of the LRU linked list in the corresponding page cluster of the hot block linked list, adjusting the page cluster to the MRU end of the hot block linked list, updating the target data page information and the page cluster information, and completing adjustment.
Specifically, step S7 specifically includes:
s701, judging whether the clean page cold chain table is empty or not, if not, and the LRU end data page is not in the latest access time window, directly removing the LRU end data page of the cold chain table from the cache, updating the cold chain table, and then executing the step S6;
s702, if the cold linked list of the clean pages is empty and the data page at the LRU end is in the last access time window, judging whether the cold linked list of the dirty data page is empty, if not, executing the step S703, otherwise, executing the step S705;
s703, if the data page accessed for the last time in the LRU end page cluster of the cold block linked list is not in the last access time window, writing all the data pages in the LRU end page cluster of the cold block linked list back to the flash memory and then removing the data pages from the cache, updating the cold block linked list, and then executing the step S8; otherwise, go to step S704;
s704, starting from the page cluster at the LRU end of the cold block linked list, calculating the average access time value of each page cluster in the cold block linked list, judging whether the average access time value is greater than tw, writing all data pages in the first page cluster meeting the conditions back to a flash memory, then removing the data pages from the cache, updating the cold block linked list, and then executing the step S8; if no page cluster meeting the conditions is found in the cold block linked list, executing step S705;
s705, if the hot linked list is not empty and the LRU end data page of the hot linked list is not in the latest access time window, executing the step S706; otherwise, executing step S707;
s706, directly removing the LRU end data page of the hot linked list from the cache, and executing the step S8 after updating the hot linked list;
s707, writing all data pages in the LRU end page cluster of the hot block linked list back to the flash memory, removing the data pages from the cache, updating the hot block linked list, and executing the step S8.
Specifically, in step S7, when a cache replacement operation occurs, the cold data page that has been accessed only once is preferentially selected as a candidate replacement object;
if the cold linked list is not empty, selecting the LRU end data page of the cold linked list as a candidate replacing object, and if the candidate replacing object is not in the latest access time window, directly replacing the candidate replacing object with the cache to finish the cache replacing operation;
if the cold linked list is empty or the data page at the LRU end of the cold linked list is in the latest access time window, selecting the page cluster at the LRU end of the cold linked list as a candidate replacement page cluster object; if the data page accessed last time in the candidate replacement page cluster is not in the last access time window, all the data pages in the page cluster are written back to the flash memory and then are removed from the cache, and the cache replacement operation is finished;
if the cold block linked list is not empty and the data page accessed last time in the LRU end page cluster of the cold block linked list is in the last access time window, calculating the average access time average _ page time of each page cluster from the LRU end of the cold block linked list to the MRU end one by one, judging whether the average _ page time > tw is satisfied, selecting the first page cluster satisfying that the average access time is greater than the last access time window value as a replacement object, writing all the data pages in the page clusters back to the flash memory and then removing the data pages from the flash memory to finish the cache replacement operation;
if the cold block linked list is empty or no page cluster meeting the replacement condition exists in the cold block linked list, selecting the data page at the LRU end of the hot linked list as a candidate replacement object; if the candidate replacing object is not in the latest access time window, the candidate replacing object is directly removed from the cache, and the cache replacing operation is finished;
and if the hot linked list is empty or the hot linked list does not have the data pages meeting the replacement condition, selecting the LRU end page cluster of the hot linked list as a replacement object, writing all the data pages in the page cluster back to the flash memory, and then removing the page cluster from the cache to finish the cache replacement operation.
Specifically, in step S8, if the read request is a read request, the target data page of the read request is erased to the MRU end of the cold chain table, and the target data page information and the cold chain table information are updated to complete the read request processing; if the request is a write request, inserting a target data page of the write request into the MRU end of the LRU linked list in the corresponding page cluster of the cold block linked list, then adjusting the page cluster to the MRU end of the cold block linked list, updating the data page information, the page cluster information and the cold block linked list information, and finishing the write request processing.
Compared with the prior art, the invention has at least the following beneficial effects:
the invention relates to a write-friendly flash memory solid-state disk cache management method, aiming at the influence of write operation on flash memory performance and the cost difference of replacing a clean data page and a dirty data page, the cache management method provided by the application manages the clean data page and the dirty data page in a cache by different granularities respectively; the data pages and page clusters with different access frequencies are respectively organized and managed by clustering dirty data pages, so that a plurality of random write operations can be merged in a cache as much as possible; when cache replacement occurs, the plurality of data pages with similar addresses and cold and hot characteristics are written back at one time, so that the plurality of data pages can be removed at one time, the cache replacement frequency is reduced, and on the other hand, the data pages with similar cold and hot characteristics can be gathered in the flash memory, the waste recovery overhead of the flash memory is reduced, and the overall performance of the flash memory is improved.
Furthermore, a cold clean data page, a hot clean data page, a cold dirty data page cluster and a hot dirty data page cluster in the management cache are organized respectively by setting a cold chain table (CL), a hot chain table (HL), a cold block chain table (CBL) and a hot block chain table (HBL), so that the additional marking overhead required for managing different characteristics of the cache data page can be reduced, and meanwhile, the clean data page and the dirty data page with different cold and hot characteristics can be quickly positioned.
Furthermore, the clean data page and the dirty data page in the cache are managed and replaced by different granularities, different replacement costs of the clean page and the dirty page are considered, replacement of the clean data page is more flexible, and a higher cache hit rate is guaranteed.
Furthermore, by clustering dirty data pages in the cache and recording the information of the page cluster by using the block nodes, the data pages with close physical addresses and the same access frequency characteristics can be clustered together.
Further, the time characteristic of the data page which is accessed last time is recorded by adding an access time mark value to the data page in each cache.
Furthermore, a latest access time window is set to protect a data page which is just accessed recently from being replaced out of the cache, and the time for the data page which just enters the cache to stay in the cache is given to explore the cold and hot characteristics of the data page, so that the stability of the cache hit rate is ensured.
Furthermore, when cache replacement occurs, the cold clean data page in the cache is preferentially selected as a replacement object, and when no cold clean page meeting the replacement condition exists in the cache, the cold dirty page cluster is selected as the replacement object, so that the write operation frequency on the flash memory is reduced.
Furthermore, when a dirty page cluster is selected as a replacement object, a plurality of data pages with similar addresses and the same cold and hot characteristics are written back at one time, so that the cache replacement times can be reduced, more reasonable distribution of data of the flash memory is facilitated, and the cost and frequency of garbage collection of the flash memory at the later stage are reduced.
In summary, the invention manages and replaces the clean data and dirty data pages in the flash buffer with different granularities respectively; and preferentially selecting a cold clean page or a cold dirty page cluster as a replacement object, and writing a plurality of data pages with similar cold and hot characteristics and address characteristics in the cache back to the flash memory together, so that the cache replacement operation times can be reduced, the random write operation times to the flash memory can be reduced, the flash memory data layout is optimized, the flash memory garbage recovery frequency and cost are reduced, and the overall performance of the flash memory is improved.
The technical solution of the present invention is further described in detail by the accompanying drawings and embodiments.
Drawings
FIG. 1 is a diagram illustrating a cache management data structure according to the present invention;
FIG. 2 is a diagram of a data structure for page cluster management according to the present invention;
FIG. 3 is a logical schematic of a recent access time window used in the present invention;
FIG. 4 is a flow chart of a process for handling I/O requests according to the present invention;
FIG. 5 is a flow chart of another process for handling I/O requests in accordance with the present invention;
FIG. 6 is a flow chart of cache replacement operation according to the present invention;
FIG. 7 is a schematic diagram of data organization according to the present invention;
FIG. 8 is a schematic diagram of another data organization according to the present invention.
Detailed Description
The invention provides a write-friendly flash memory solid-state disk cache management method, which is used for managing and replacing a clean data page and a dirty data page in a cache with different granularities according to whether the data page in the cache is modified, and comprises the following specific steps:
s1, managing clean data pages in the cache by taking the pages as basic units, and simultaneously carrying out page cluster operation on dirty data pages in the cache according to different flash memory physical blocks to which the dirty data pages belong so as to organize a plurality of data pages of the same flash memory physical block into a page cluster;
referring to fig. 1, the cache management method uses two LRU linked lists to manage clean data pages in the cache: cold linked lists (Cold-List, CL for short) and Hot linked lists (Hot-List, HL for short). The CL chain is used to manage clean data pages that have been accessed only once in the cache, and the HL chain is used to manage clean data pages that have been hit in the cache, i.e., clean data pages that have been accessed twice or more.
The cache management method adopts two LRU linked lists to manage dirty data page clusters in the cache: a Cold Block linked List (Cold-Block List, hereinafter CBL) and a Hot Block linked List (Hot-Block List, hereinafter HBL). The CBL linked list is used for managing page clusters of the dirty data page aggregation which are accessed only once, and the HBL linked list is used for managing page clusters of the dirty data page aggregation which are hit in the cache.
Referring to fig. 2, in the page cluster nodes managed by the CBL link table and the HBL link table related to the cache management method, each node uses one LRU link table to manage data pages in the page cluster.
S2, setting a system access time visit _ time to record the number of times the data page is accessed. Setting the initial value to be 0, and recording the time mark of the cache access data page;
and adding an access time mark value page _ time to each data page in the cache, and recording the last time when the data page in the cache is accessed.
The cache management method specifically comprises the following steps of: when a user I/O request comes, every time a data page is accessed, the visit _ time value performs an operation of adding 1, meanwhile, the current visit _ time value is assigned to the page _ time of the accessed data page, and the access time mark of the currently accessed data is recorded.
And S3, setting a latest access time window. The last access time window covers a plurality of data pages which are accessed recently in the cache, and the last access time window value tw represents the range of the data pages which are not replaced in the protection cache when the cache replacement operation occurs.
The present application sets the size of the latest access time window value tw to 10% to 50% of the size of the cache space, and it is understood that other window size values are within the technical scope of the present application, and it is preferable to set the latest access time window value tw to 10% of the size of the cache space.
Referring to fig. 3, the policy for managing the cached data page is: and regarding the data page in the cache as a logical LRU linked list according to the sequence of the access time marker value, wherein the latest access time window refers to the data page with the length of the MRU end of the logical LRU linked list being in the tw range.
Judging a data page PiThe judgment criterion of whether the time window is accessed recently is as follows: calculating the current system access time stamp value and the data page PiAccess time stamp value PiWhether the difference value of _ page _ time is greater than the latest access time window value tw or not, and if the calculated difference value is greater than tw, the data page P is indicatediNot within the most recent access time window; otherwise, data page P is illustratediWithin the last access time window.
When a data page is determined to be within the last access time window, it is determined that the data page is the data page that has just been accessed recently, and according to the access locality principle, the data page has a high probability of being accessed again, so that the data page should be given time to reside in the cache to explore its cold and hot characteristics and protect the data page from being replaced out of the cache.
S4, after receiving the target data page of the upper layer application I/O request, the flash memory solid state disk firstly judges whether the target data page is hit in the cache, if so, executing S5; if not, go to S6;
s5, after hit in the cache, firstly returning the target page to the upper application program, and then adjusting the target page to the corresponding MRU end of the hot linked list; referring to fig. 4, the specific operation steps are as follows:
s501, judging whether the I/O request is a read request and whether a hit target page is a clean page, if so, executing a step S502, and if not, executing a step S503;
s502, adjusting the current position of the target page to the end of the HL chain table MRU, updating the information of the target page and the HL chain table, and finishing adjustment;
s503, adjusting the target page from the current position to the MRU end of the LRU linked list in the corresponding page cluster of the HBL linked list, adjusting the page cluster to the MRU end of the HBL linked list, updating the target data page information and the page cluster information, and completing the adjustment.
S6, if the I/O request is not hit in the cache, reading the target data of the I/O request from the flash memory and returning the target data to the upper layer application, and inserting the data into the corresponding cache management linked list;
referring to fig. 5, the specific process flow is as follows: firstly, judging whether a free space in a cache meets the requirement of storing a target data page of the I/O request, if not, executing S7; otherwise, executing S8;
s7, when there is not enough free space in the cache to store the target data page of the I/O request, a cache replacement algorithm is executed.
Referring to fig. 6, the cache replacement algorithm provided in the present application preferentially replaces cold data pages in the cache, and when there is no cold data page meeting the replacement condition in the cache, a replacement object is selected according to the priority order of the hot clean data page and the hot dirty data page cluster; the specific alternative flow is as follows:
firstly, judging whether a clean page linked list CL is empty or not, if not, executing S701 if the LRU end data page is not in a latest access time window; otherwise, executing S702;
s701, directly removing the data page of the LRU end of the CL chain table from the cache, updating the CL chain table, and then executing S6;
s702, judging whether the dirty data page linked list CBL is empty, if not, executing S703, otherwise, executing S705;
s703, if the data page accessed for the last time in the LRU end page cluster of the CBL linked list is not in the last access time window, writing all the data pages in the LRU end page cluster of the CBL linked list back to the flash memory and then removing the data pages from the cache, updating the CBL linked list, and then executing S8; otherwise, executing S704;
s704, starting from the page cluster at the LRU end of the CBL linked list, calculating the average access time value of each page cluster in the CBL linked list, judging whether the average access time value is greater than tw, writing all data pages in the first page cluster meeting the conditions back to a flash memory, then removing the data pages from the cache, updating the CBL linked list, and then executing S8; if no page cluster meeting the conditions is found in the CBL, S705 is executed;
s705, if the HL chain table does not have the data page of the LRU end of the HL chain table within the latest access time window, S706 is executed; otherwise, executing S707;
s706, directly removing the data page of the LRU end of the HL chain table from the cache, and executing S8 after updating the HL chain table;
s707, writing all data pages in the HBL linked list LRU end page cluster back to the flash memory, removing the data pages from the cache, updating the HBL linked list, and executing S8;
when the cache replacement operation occurs, the cold data page which is accessed only once is preferentially selected as a candidate replacement object,
if the CL chain table is not empty, the data page at the LRU end of the CL chain table is selected as a candidate replacing object, and if the candidate replacing object is not in the latest access time window, the candidate replacing object is directly replaced out of the cache, so that the cache replacing operation is completed.
And if the CL chain table is empty or the data page at the LRU end of the CL chain table is in the latest access time window, selecting the page cluster at the LRU end of the CBL chain table as a candidate replacement page cluster object. And if the data page accessed last time in the candidate replacement page cluster is not in the last access time window, writing all the data pages in the page cluster back to the flash memory and then removing the data pages from the cache to finish the cache replacement operation.
If the CBL linked list is not empty and the data page accessed last time in the LRU end page cluster of the CBL linked list is in the last access time window, the average access time average _ page time of each page cluster is calculated one by one from the LRU end of the CBL linked list to the MRU end, whether the average _ page time > tw is satisfied or not is judged, the first page cluster satisfying that the average access time is larger than the last access time window value is selected as a replacement object, all the data pages in the page cluster are written back to the flash memory and then removed from the flash memory, and the cache replacement operation is completed.
And if the CBL linked list is empty or no page cluster meeting the replacement condition exists in the CBL, selecting the data page at the LRU end of the HL linked list as a candidate replacement object. If the candidate replacing object is not in the latest access time window, the candidate replacing object is directly removed from the cache, and the cache replacing operation is completed.
And if the HL chain table is empty or the HL chain table does not have the data pages meeting the replacement conditions, selecting an LRU end page cluster of the HBL chain table as a replacement object, writing all the data pages in the page cluster back to the flash memory, and then removing the page cluster from the cache to finish the cache replacement operation.
S8, referring to fig. 5, when the target data of the I/O request is not hit in the cache, the target data of the I/O request is read from the flash memory and returned to the upper application, and then the target data page is inserted into the corresponding management linked list in the cache according to the read-write type of the I/O request. If the request is a read request, executing S801; if the request is a write request, executing S802;
s801, erasing the target data page of the read request to the MRU end of the CL chain table, updating the target data page information and the CL chain table information, and finishing the read request processing.
S802, inserting the target data page of the write request into the MRU end of the LRU linked list in the corresponding page cluster of the CBL linked list, then adjusting the page cluster to the MRU end of the CBL linked list, updating the data page information, the page cluster information and the CBL linked list information, and finishing the write request processing.
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. The components of the embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 7, it is assumed that the latest access time window value tw is set to 5, the system current access time visit _ time is 101, the system current access data page is P11, and the access time stamp value is 100. When a cache replacement operation occurs, the data page at the LRU end of the CL chain is first selected as a candidate replacement, which is P8 in FIG. 7. And the P8 data page is in the last access time window, and according to the cache management method provided by the invention, the P8 is protected from being replaced out of the cache.
The page cluster at the LRU end of the CBL linked list is initially selected as the candidate replacement, and page cluster 0 is selected as the candidate replacement in fig. 7. The page cluster 0 comprises two data pages P7 and P2, and the data page P7 at the MRU end of the LRU linked list in the page cluster 0 is in the latest access time window, so as to avoid the problems that the individual data pages in the dirty page cluster are protected, so that most cold data pages reside in the cache, the cache space is wasted, cache hit is reduced and the like. The calculation starts with the page cluster at the LRU end of the CBL linked list, which is page cluster 0 in FIG. 7.
The page cluster 0 contains two data pages, P7 and P2, and as can be seen from the access sequence chain table, the difference between the access time stamp value and the access time stamp value of the current system is 5 and 10, respectively, and the average access time distance of the data pages in the page cluster 0 is (5+10)/2 is 7.5, which is greater than the value of the latest access time window 5, so all the data pages in the page cluster will be written back to the flash memory, all the data pages in the page cluster will be removed from the cache, and then the CBL chain table is adjusted. Fig. 8 shows a schematic diagram of an adjusted cache management structure.
In summary, in the write-friendly flash memory solid-state disk cache management method, considering that the write operation of the flash memory has important influence on the garbage collection overhead and the garbage collection frequency of the flash memory solid-state disk, a plurality of data pages with the same cold and hot characteristics and the similar physical addresses are organized and managed by using the block nodes through clustering operation on dirty data pages in the cache. When cache replacement occurs, the cache management method provided by the application preferentially replaces cold clean data and a dirty data page cluster which is not accessed for the longest time in the cache as replacement objects, and writes data pages in the page cluster back to the flash memory together. On one hand, the frequency of cache replacement can be reduced, and on the other hand, the data layout in the flash memory is optimized by writing back a plurality of data pages with the same cold and hot characteristics once, so that the influence of write operation on the garbage recovery overhead of the flash memory is reduced, and the overall performance of the flash memory solid-state disk is improved. The cache management method provided by the application can adapt to various data loads and has good robustness.
The above-mentioned contents are only for illustrating the technical idea of the present invention, and the protection scope of the present invention is not limited thereby, and any modification made on the basis of the technical idea of the present invention falls within the protection scope of the claims of the present invention.

Claims (9)

1. A write-friendly flash memory solid-state disk cache management method is characterized by comprising the following steps:
s1, managing clean data pages in the cache by taking the pages as basic units, carrying out page cluster operation on dirty data pages in the cache according to different flash memory physical blocks to which the dirty data pages belong, and organizing a plurality of data pages belonging to the same flash memory physical block into one page cluster;
s2, setting system access time visit _ time to record the times of accessing the data page, setting the initial value of the time visit _ time to be 0, and recording the time mark of caching the access data page;
s3, setting a latest access time window tw to indicate the range of data pages which are not replaced in a protection cache when cache replacement operation occurs, and covering a plurality of data pages which are accessed recently in the cache by using the latest access time window tw;
s4, after receiving the target data page of the upper layer application I/O request, the flash memory solid state disk firstly judges whether the target data page is hit in the cache, if so, the step S5 is executed; if not, go to step S6;
s5, after the hit in the cache, returning the target page to the upper application program, and adjusting the target page to the corresponding MRU end of the hot link table;
s6, if the I/O request is not hit in the cache, reading the target data of the I/O request from the flash memory and returning the target data to the upper application, inserting the data into the corresponding cache management linked list, if the cache has a free space to satisfy the target data page for storing the I/O request, executing the step S8, and if the cache does not satisfy the free space, executing the step S7;
s7, when there is not enough free space in the cache to store the target data page of the I/O request, executing a cache replacement algorithm and then executing supplement S8;
s8, when the target data of the I/O request is not hit in the cache, the target data of the I/O request is read from the flash memory and returned to the upper application, and then the target data page is inserted into the corresponding management linked list in the cache according to the read-write type of the I/O request, so as to realize cache management.
2. The write-friendly flash memory solid-state disk cache management method according to claim 1, wherein in step S1, the clean data pages in the cache are managed by using a cold chain table and a hot chain table, the cold chain table is used for managing the clean data pages that have been accessed only once in the cache, and the hot chain table is used for managing the clean data pages that hit in the cache, that is, the clean data pages that have been accessed twice or more; the dirty data page clusters in the cache are managed by adopting a cold block linked list and a hot block linked list, the cold block linked list is used for managing page clusters of dirty data page aggregation which are accessed only once, and the hot block linked list is used for managing page clusters of dirty data page aggregation which are hit in the cache.
3. The write-friendly flash memory solid-state disk cache management method according to claim 1, wherein in step S2, when a user I/O request comes, every time a data page is accessed, the visit _ time value performs an add-1 operation, and meanwhile, the current visit _ time value is assigned to the page _ time of the accessed data page, and the access time stamp of the currently accessed data is recorded.
4. The write-friendly flash memory solid-state disk cache management method according to claim 1, wherein in step S3, the size of the latest access time window tw is set to be 10% to 50% of the size of the cache space, and the data pages in the cache are regarded as a logical LRU linked list according to the sequence of the access time stamp values, and the latest access time window is the data page within the range of tw at the MRU end of the logical LRU linked list.
5. The write-friendly flash memory solid-state disk cache management method according to claim 4, wherein one data page P is judgediThe basis for whether it is within the last access time window is: calculating current system access time stamp value and data page PiAccess time stamp value PiWhether the difference value of _ page _ time is greater than the latest access time window value tw, if the calculated difference value is greater than the latest access time window value tw, the data page PiNot within the most recent access time window; otherwise, data page PiWithin the most recent access time window; when a data page is judged to be in the latest access time window, the data page is the data page which is accessed recently, the time for the data page to reside in the cache is given, and the data page is protected from being replaced out of the cache.
6. The write-friendly flash memory solid-state disk cache management method according to claim 1, wherein the step S5 is specifically:
s501, judging whether the I/O request is a read request and whether a hit target page is a clean page, if so, executing a step S502, and if not, executing a step S503;
s502, adjusting the target page from the current position to the end of the hot link table MRU, updating the target page information and the hot link table, and finishing adjustment;
s503, adjusting the target page from the current position to the MRU end of the LRU linked list in the corresponding page cluster of the hot block linked list, adjusting the page cluster to the MRU end of the hot block linked list, updating the target data page information and the page cluster information, and completing adjustment.
7. The write-friendly flash memory solid-state disk cache management method according to claim 1, wherein the step S7 is specifically:
s701, judging whether the clean page cold chain table is empty or not, if not, and the LRU end data page is not in the latest access time window, directly removing the LRU end data page of the cold chain table from the cache, updating the cold chain table, and then executing the step S6;
s702, if the cold linked list of the clean pages is empty and the data page at the LRU end is in the last access time window, judging whether the cold linked list of the dirty data page is empty, if not, executing the step S703, otherwise, executing the step S705;
s703, if the data page accessed for the last time in the LRU end page cluster of the cold block linked list is not in the last access time window, writing all the data pages in the LRU end page cluster of the cold block linked list back to the flash memory and then removing the data pages from the cache, updating the cold block linked list, and then executing the step S8; otherwise, go to step S704;
s704, starting from the page cluster at the LRU end of the cold block linked list, calculating the average access time value of each page cluster in the cold block linked list, judging whether the average access time value is greater than tw, writing all data pages in the first page cluster meeting the conditions back to a flash memory, then removing the data pages from the cache, updating the cold block linked list, and then executing the step S8; if no page cluster meeting the conditions is found in the cold block linked list, executing step S705;
s705, if the hot linked list is not empty and the LRU end data page of the hot linked list is not in the latest access time window, executing the step S706; otherwise, executing step S707;
s706, directly removing the LRU end data page of the hot linked list from the cache, and executing the step S8 after updating the hot linked list;
s707, writing all data pages in the LRU end page cluster of the hot block linked list back to the flash memory, removing the data pages from the cache, updating the hot block linked list, and executing the step S8.
8. The write-friendly flash memory solid-state disk cache management method according to claim 1 or 7, wherein in step S7, when a cache replacement operation occurs, a cold data page that has been accessed only once is preferentially selected as a candidate replacement object;
if the cold linked list is not empty, selecting the LRU end data page of the cold linked list as a candidate replacing object, and if the candidate replacing object is not in the latest access time window, directly replacing the candidate replacing object with the cache to finish the cache replacing operation;
if the cold linked list is empty or the data page at the LRU end of the cold linked list is in the latest access time window, selecting the page cluster at the LRU end of the cold linked list as a candidate replacement page cluster object; if the data page accessed last time in the candidate replacement page cluster is not in the last access time window, all the data pages in the page cluster are written back to the flash memory and then are removed from the cache, and the cache replacement operation is finished;
if the cold block linked list is not empty and the data page accessed last time in the LRU end page cluster of the cold block linked list is in the last access time window, calculating the average access time average _ page time of each page cluster from the LRU end of the cold block linked list to the MRU end one by one, judging whether the average _ page time > tw is satisfied, selecting the first page cluster satisfying that the average access time is greater than the last access time window value as a replacement object, writing all the data pages in the page clusters back to the flash memory and then removing the data pages from the flash memory to finish the cache replacement operation;
if the cold block linked list is empty or no page cluster meeting the replacement condition exists in the cold block linked list, selecting the data page at the LRU end of the hot linked list as a candidate replacement object; if the candidate replacing object is not in the latest access time window, the candidate replacing object is directly removed from the cache, and the cache replacing operation is finished;
and if the hot linked list is empty or the hot linked list does not have the data pages meeting the replacement condition, selecting the LRU end page cluster of the hot linked list as a replacement object, writing all the data pages in the page cluster back to the flash memory, and then removing the page cluster from the cache to finish the cache replacement operation.
9. The write-friendly flash memory solid-state disk cache management method according to claim 1, wherein in step S8, if the read request is a read request, the target data page of the read request is erased to the MRU end of the cold chain table, the target data page information and the cold chain table information are updated, and the read request processing is completed; if the request is a write request, inserting a target data page of the write request into the MRU end of the LRU linked list in the corresponding page cluster of the cold block linked list, then adjusting the page cluster to the MRU end of the cold block linked list, updating the data page information, the page cluster information and the cold block linked list information, and finishing the write request processing.
CN202010374302.0A 2020-05-06 2020-05-06 Write-friendly flash memory solid-state disk cache management method Active CN111580754B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010374302.0A CN111580754B (en) 2020-05-06 2020-05-06 Write-friendly flash memory solid-state disk cache management method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010374302.0A CN111580754B (en) 2020-05-06 2020-05-06 Write-friendly flash memory solid-state disk cache management method

Publications (2)

Publication Number Publication Date
CN111580754A true CN111580754A (en) 2020-08-25
CN111580754B CN111580754B (en) 2021-07-13

Family

ID=72126206

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010374302.0A Active CN111580754B (en) 2020-05-06 2020-05-06 Write-friendly flash memory solid-state disk cache management method

Country Status (1)

Country Link
CN (1) CN111580754B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112559381A (en) * 2020-09-24 2021-03-26 北京航空航天大学 NVMe-oriented IO deterministic optimization strategy method
CN114201120A (en) * 2022-02-18 2022-03-18 苏州浪潮智能科技有限公司 Data reading and writing method and device and related equipment
CN115469815A (en) * 2022-10-31 2022-12-13 之江实验室 Cache management method, device, equipment and storage medium for improving reliability of flash memory
CN118012788A (en) * 2024-04-09 2024-05-10 北京壁仞科技开发有限公司 Data processor, data processing method, electronic device, and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170110196A1 (en) * 2013-03-13 2017-04-20 Winbond Electronics Corp. Nand flash memory
CN108762664A (en) * 2018-02-05 2018-11-06 杭州电子科技大学 A kind of solid state disk page grade buffer queue management method
CN110888600A (en) * 2019-11-13 2020-03-17 西安交通大学 Buffer area management method for NAND flash memory

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170110196A1 (en) * 2013-03-13 2017-04-20 Winbond Electronics Corp. Nand flash memory
CN108762664A (en) * 2018-02-05 2018-11-06 杭州电子科技大学 A kind of solid state disk page grade buffer queue management method
CN110888600A (en) * 2019-11-13 2020-03-17 西安交通大学 Buffer area management method for NAND flash memory

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112559381A (en) * 2020-09-24 2021-03-26 北京航空航天大学 NVMe-oriented IO deterministic optimization strategy method
CN114201120A (en) * 2022-02-18 2022-03-18 苏州浪潮智能科技有限公司 Data reading and writing method and device and related equipment
WO2023155531A1 (en) * 2022-02-18 2023-08-24 苏州浪潮智能科技有限公司 Data read-write method and apparatus and related device
CN115469815A (en) * 2022-10-31 2022-12-13 之江实验室 Cache management method, device, equipment and storage medium for improving reliability of flash memory
CN118012788A (en) * 2024-04-09 2024-05-10 北京壁仞科技开发有限公司 Data processor, data processing method, electronic device, and storage medium

Also Published As

Publication number Publication date
CN111580754B (en) 2021-07-13

Similar Documents

Publication Publication Date Title
US10838859B2 (en) Recency based victim block selection for garbage collection in a solid state device (SSD)
CN107066393B (en) Method for improving mapping information density in address mapping table
CN111580754B (en) Write-friendly flash memory solid-state disk cache management method
US9378131B2 (en) Non-volatile storage addressing using multiple tables
CN101477492B (en) Circulating rewriting flash memory equalization method used for solid state disk
CN107391398B (en) Management method and system for flash memory cache region
US10740251B2 (en) Hybrid drive translation layer
CN110888600B (en) Buffer area management method for NAND flash memory
CN108762664B (en) Solid state disk page-level cache region management method
US20120239851A1 (en) Prioritized erasure of data blocks in a flash storage device
CN104102591A (en) Computer subsystem and method for implementing flash translation layer in computer subsystem
CN107463509B (en) Cache management method, cache controller and computer system
CN108845957B (en) Replacement and write-back self-adaptive buffer area management method
CN110795363B (en) Hot page prediction method and page scheduling method of storage medium
CN111352593B (en) Solid state disk data writing method for distinguishing fast writing from normal writing
US8954646B2 (en) Method for managing a plurality of blocks of a flash memory, and associated memory device and controller thereof
CN110532200B (en) Memory system based on hybrid memory architecture
CN108647157B (en) Mapping management method based on phase change memory and solid state disk
CN109002400B (en) Content-aware computer cache management system and method
CN108664217B (en) Caching method and system for reducing jitter of writing performance of solid-state disk storage system
KR101020781B1 (en) A method for log management in flash memory-based database systems
KR101353967B1 (en) Data process method for reading/writing data in non-volatile memory cache having ring structure
KR101373613B1 (en) Hybrid storage device including non-volatile memory cache having ring structure
CN113608698B (en) Heterogeneous memory page migration system and method based on DRAM sacrificial Cache
US20220374360A1 (en) Memory device and method for accessing memory device

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