CN108845957B - Replacement and write-back self-adaptive buffer area management method - Google Patents

Replacement and write-back self-adaptive buffer area management method Download PDF

Info

Publication number
CN108845957B
CN108845957B CN201810276887.5A CN201810276887A CN108845957B CN 108845957 B CN108845957 B CN 108845957B CN 201810276887 A CN201810276887 A CN 201810276887A CN 108845957 B CN108845957 B CN 108845957B
Authority
CN
China
Prior art keywords
write
buffer area
block
list
buffer
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
CN201810276887.5A
Other languages
Chinese (zh)
Other versions
CN108845957A (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.)
Hangzhou Dianzi University
Original Assignee
Hangzhou Dianzi 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 Hangzhou Dianzi University filed Critical Hangzhou Dianzi University
Priority to CN201810276887.5A priority Critical patent/CN108845957B/en
Publication of CN108845957A publication Critical patent/CN108845957A/en
Application granted granted Critical
Publication of CN108845957B publication Critical patent/CN108845957B/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
    • G06F12/0253Garbage collection, i.e. reclamation of unreferenced 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/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0866Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches for peripheral storage systems, e.g. disk cache
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/72Details relating to flash memory management
    • G06F2212/7205Cleaning, compaction, garbage collection, erase control

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

The invention provides a buffer area management method with self-adaption of replacement and write-back, which divides a buffer area into a buffer block record table, a write buffer area and a read buffer area; the buffer block record table is used for recording the position information of the data pages belonging to the same logical data block in the buffer area, the write buffer area is used for buffering the data pages which are modified in response to the write request, and the read buffer area is used for buffering the data pages which are only in response to the read request and are not modified. The invention adopts a page-level management mode when loading and rejecting the data pages, and can sense the change of the read-write characteristics of the load by periodically and adaptively adjusting the threshold value of the read buffer, so that the management method can obtain higher cache hit rate under various load conditions. Meanwhile, the dirty page self-adaptive clustering write-back is adopted, the pressure of FTL layer garbage recovery can be sensed, the write-back strategy is self-adaptively adjusted, the number of times of erasing extra blocks caused by FTL garbage recovery can be effectively reduced, and the overall performance and the service life of the solid state disk are improved.

Description

Replacement and write-back self-adaptive buffer area management method
Technical Field
The invention belongs to the technical field of firmware optimization method design based on a flash memory solid-state disk, and discloses a replacement and write-back self-adaptive buffer area management method.
Background
Toshiba corporation proposed a new type of non-volatile storage medium, NAND flash memory (flash memory), in 1989, which is widely used in embedded devices, portable computers and enterprise-level storage systems because of its advantages of high performance, low power consumption and good shock resistance. The flash memory referred to herein is a NAND flash memory.
The buffer area is an indispensable part in the composition of the storage system, and the I/O performance of the storage system can be effectively improved by storing frequently accessed data in a cache with small capacity. For decades, researchers have proposed many classic and effective buffer methods for storage systems using mechanical hard disks as main storage media, such as FIFO (first-in first-out method), LRU (least recently used method), LFU (least recently used replacement method), and LRFU (most recently and least frequently used replacement method), among others. However, the bottom storage medium of the solid state disk is a flash memory, and the flash memory has the characteristic obviously different from the traditional magnetic medium, so that the traditional cache region management algorithm for the mechanical hard disk is difficult to apply in the design of the cache region of the solid state disk.
The NAND flash memory at the bottom of the solid state disk has the following limitations: 1) the flash memory only provides 3 operations of reading, writing and erasing, and the three operations have asymmetric performance, the fastest reading, the slowest writing and the slowest erasing; 2) the flash memory is organized according to the structures of pages (pages), blocks (blocks) and planes (planes); a page is the minimum unit of read/write, typically 2/4/8 KB; a block is the minimum unit of erase, a block typically containing 64/128 pages; 3) flash memory can only be written once after being erased, so-called erase-before-write, which causes flash memory to not support in-place updates; 4) the flash memory has a limited number of program/erase (P/E) times per cell, beyond which the data stored in the flash memory is no longer reliable.
For the asymmetry of reading and writing of flash memories, researchers have proposed a series of flash memory-oriented buffer area methods, which can be classified into a page-level buffer area method and a block-level buffer area method according to the operation granularity.
Page level buffer method: most of the improved methods are based on LRU, among which the classical effective methods are CFLRU (clean Page priority least recent replacement) method, CCF-LRU (Cold Dry Page priority least recent replacement) method, and AD-LRU (adaptive double queue minimum Cold Page replacement) method. However, these methods only consider the state of the replacement page in the buffer, but neglect the characteristics of the current access load, resulting in that each method can only be applied to a specific load to obtain better performance. Compared with a page-level buffer method which performs write-back operation by using a single page, the block-level buffer method performs write-back by using a block as an organization unit during the write-back operation, can effectively reconstruct an access mode, and converts random write requests into continuous write requests, thereby effectively reducing garbage recycling overhead of a bottom FTL.
Block level buffer method: based on the BPLRU (block-filling least-recently-replaced) method and the FAB (maximum block-first-replaced) method, a PUD-LRU (predicted available Update Distance LRU) method and a CLC (Cold and target Cluster) method are derived. However, these block-level buffer methods only buffer write requests, and perform poorly in a load environment that is dominated by read requests. In addition, when a dirty page is written back, the block-level cache region methods do not distinguish cold and hot data pages in the same write-back block, so that a part of hot data pages are written back prematurely, meanwhile, the pressure of garbage collection of a Flash Translation Layer (FTL) at the bottom Layer cannot be sensed during write-back, and a single write-back strategy is adopted, so that extra garbage collection overhead of the FTL Layer is caused.
Disclosure of Invention
Aiming at the defects in the prior art, the invention discloses a replacement and write-back self-adaptive buffer area management method, which not only can dynamically adjust a replacement strategy according to load read-write characteristics to improve the read-write hit rate of the buffer area, but also can retain a hot data page during cluster write-back and adjust a write-back strategy according to garbage recovery pressure of a Flash Translation Layer (FTL) to reduce the erasing times of a bottom layer flash memory block.
In order to realize the purpose of the invention, the invention adopts the following technical scheme:
a replacement and write-back self-adaptive buffer area management method is disclosed, wherein the buffer area is divided into a buffer block record table, a write buffer area and a read buffer area; the cache block record table is used for recording the position information of data pages belonging to the same logical data block in a buffer area, the write buffer area is used for caching the data pages which are modified in response to a write request, and the read buffer area is used for caching the data pages which are only in response to a read request and are not modified;
the management method comprises the following steps:
s1, when the access request comes, inquiring whether the cache block record table contains the cache block information corresponding to the request, if yes, executing S2, otherwise, executing S4;
s2, inquiring whether a position pointer pointing to the requested data page exists in the cache block record table, if so, executing S3, otherwise, executing S5;
s3, transferring the hit data page to the MRU position of the corresponding buffer area, and updating the position pointer list in the corresponding buffer block record table; then executing S8;
s4, adding corresponding record block information to the buffer block record table, initializing all information of the record block, and then executing S5;
s5, judging whether the current buffer area is full; if yes, executing S6, otherwise, executing S7;
s6, comparing the size of the read buffer with a target threshold Tau; if so, selecting the data page at the LRU position of the read buffer area to be removed, otherwise, selecting the data page at the LRU position of the write buffer area as a removal item and executing self-adaptive cluster write-back; updating record block information corresponding to the removed data page, and then executing S7;
s7, loading the missing request data page into the corresponding buffer area, adding the position pointing to the data page into the position pointer list of the corresponding cache block record table, and updating the corresponding record block information; then executing S8;
s8, starting a replacement strategy threshold value adjusting mechanism to adjust the threshold value Tau; and finally, ending the processing of the request.
Further, the read buffer and the write buffer adopt LRU management queues, and when the buffer hits requests and loads new data pages, the hit requests and the loaded new data pages are migrated to MRU positions of the queues.
Further, in the cache block record table, the information of one record block includes: the number BlkNum of the cache block, the number BlkSize of data pages belonging to the same record block in the buffer area, a clean page position pointer list C-list-index belonging to the same record block and a dirty page position pointer list D-list-index belonging to the same record block.
Further, in step S3, the step of updating the location pointer list in the corresponding cache block record table specifically includes:
removing an old position pointer pointing to the migration data page from the C-list-index or D-list-index list, then judging a migration position, and if the migration position is migrated into the read buffer area, storing the position pointer into the corresponding C-list-index in the cache block; otherwise, the position pointer of the data page is stored into the D-list-index in the record block.
Further, in step S6, the updating the record block information corresponding to the removed data page specifically includes:
and finding an old position pointer pointing to the removed data page from the C-list-index or D-list-index list, removing the old position pointer, and updating the BlkSize of the corresponding recording block to be BlkSize-1.
Further, in step S7, the adding the location pointing to the data page to the location pointer list of the corresponding cache block record table, and updating the corresponding record block information specifically includes:
judging the type of the request, and if the request is a read request, storing the position pointer of the newly added data page into the corresponding cache record block C-list-index; otherwise, the position pointer of the data page is stored in the D-list-index of the recording block, and then the BlkSize of the corresponding recording block is updated to be BlkSize + 1.
Further, in step S6, the adaptive clustering write-back process includes:
s61, selecting the data page at the position of the write buffer LRU as a removal object, inquiring the D-list-index information in the cache record block corresponding to the data page, and then executing S62;
s62, sequentially reading data pages pointed by the position pointers of the D-list-index, judging the data pages pointed by the position pointers of the D-list-index according to the principle that the data pages positioned at the front half part of the cache queue are hot data, adding the data pages judged to be hot into the reserved set phi, and then executing S63;
s63, calculating the current write amplification factor
Figure BDA0001613820660000031
Calculating the current write back threshold according to the current write amplification factor W
Figure BDA0001613820660000032
Wherein Bw is a statistical value of write-back times of the cache region in a fixed period; fw is a flash memory write operation frequency counting value in a fixed period; BlkMaxSize is the logical data block size, t is a constant coefficient;
then executing S64;
s64, calculating the filling page number E ═ BlkMaxSize-N, wherein N is the number of data pages of the current recording block in the writing buffer area, and then comparing the sizes of E and Th; if E is less than or equal to Th, executing S65; otherwise, go to S66;
s65, starting page filling, reading E filling pages from the bottom layer flash memory and writing back dirty pages to form a whole data block and writing back the whole data block into the bottom layer flash memory; then executing S67;
s66, not starting page filling, completely writing back the dirty pages in the D-list-index into the bottom layer flash memory, and executing S67;
s67, all data pages in the aggregate phi are moved to a read buffer area, the position information of the D-list-index in a cache block record table of an original data block is deleted, and a new position pointer after transfer is stored in the C-list-index; and finally ending the cluster write-back operation.
Further, in step S8, the starting of the replacement policy threshold adjustment mechanism adjusts the threshold Tau, and the specific adjustment process is as follows:
s81, judging whether the current request is hit, if yes, executing S82, otherwise, executing S83;
s82, judging the request type and the hit area, if the read buffer area hits, adding 1 to CRH; if the read buffer write hits, then CWH adds 1; if the write buffer area is read hit, DRH adds 1; if the write buffer zone is hit, adding 1 to CRH; finally, executing S83;
s83, updating the current TCount, that is, TCount +1, and updating the statistical value Bw and the statistical value Fw, and then executing S84;
s84, judging whether TCount reaches the threshold updating cycle cycleTime, if so, executing S85, otherwise, ending the updating operation of the threshold Tau;
wherein, CRH is the read hit statistical variable of the read buffer, CWH is the write hit statistical variable of the read buffer; DRH is a read hit statistical variable of a write buffer area, and DWH is a write hit statistical variable of the write buffer area; TCount is the current request operation count; the CycleTime is a threshold updating period;
s85, calculating a target write buffer unity gain DR, a target read buffer unity gain CR:
Figure BDA0001613820660000041
wherein BufSize is the size of the total read-write buffer, Tau' is the threshold before updating,
cr and Cw are normalized to obtain a read-write delay cost coefficient:
Figure BDA0001613820660000042
wherein, ReadDelay and WriteDelay are read delay and write delay in a period respectively; and then S86 is executed.
S86, update threshold Tau:
Figure BDA0001613820660000043
and simultaneously updating the write-back frequency statistic Bw of the period buffer area to be 0, the period flash memory write operation frequency statistic Fw to be 0, the period count value TCount to be 1, and finally ending the updating operation of the threshold Tau.
Compared with the prior art, the invention has the beneficial effects that:
the replacement and write-back self-adaptive buffer management method provided by the invention adopts a page-level management mode when loading and rejecting data pages, and can sense the change of load reading and writing characteristics by periodically and self-adaptively adjusting the read buffer threshold value, so that the management method can obtain higher cache hit rate under various load conditions. Secondly, when the dirty pages are clustered and written back, the management method provided by the invention can sense the pressure of FTL layer garbage recovery, adaptively adjust the write-back strategy, effectively reduce the number of times of erasing extra blocks caused by FTL garbage recovery, and improve the overall performance and service life of the solid state disk.
Drawings
In order to more clearly illustrate the embodiments or technical solutions of the present invention, the drawings used in the embodiments or technical solutions of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained based on these drawings without inventive effort.
FIG. 1: the cache block record of the present invention represents intent.
FIG. 2: the invention discloses a structure diagram of a read-write buffer queue.
FIG. 3: the invention discloses a self-adaptive clustering write-back flow chart.
FIG. 4: the invention relates to a periodic threshold adjustment flow chart.
FIG. 5: the request processing general flow chart of the present invention.
FIG. 6: example process diagrams of the present invention.
Detailed Description
In order that those skilled in the art will better understand the technical solutions of the present invention, the following detailed description of the present invention is provided in conjunction with the accompanying drawings and the specific embodiments.
For further detailed description of the invention, it is first necessary to give a definition of the concepts related to the invention:
caching a data page: the basic reading and writing unit of the cache is consistent with the physical page size of the flash memory.
Caching a data block: and carrying out division operation on the size of the physical block by the data request page address to obtain a set consisting of data pages with consistent quotient, wherein the maximum contained page number of the data block is consistent with the contained physical page number of the underlying physical block.
Logical page address: the host I/O request P is numbered according to the identified logical address (LPN) of its file system.
Logical block number: which is also the Number of the cached data Block (Block Number, BlkNum), specifies the BlkNum of the request P as its LPN divided by the maximum Number of pages of the data Block.
The invention provides a replacement and write-back self-adaptive buffer area management method, which divides a cache into three parts: a cache block record table, a Write Buffer (Write Buffer) and a Read Buffer (Read Buffer).
The buffer block record table is used for recording the position and the state of different data pages belonging to a data block in the buffer area. The cache block record table accelerates the query, update and write-back operations of the requested data page by recording the position pointers of different data pages.
As shown in fig. 1, in the cache block record table, the information of the record block specifically includes: the number of the current buffer block BlkNum, the number of data pages BlkSize which belong to the recording block in the current buffer area, a clean page position pointer list C-list-index which belongs to the recording block in the same way, and a dirty page position pointer list D-list-index which belongs to the recording block in the same way. The size of the cache block is consistent with the size of the physical block of the actual bottom layer, namely the number of the contained data pages is the same, and the size value of the cache block is BlkMaxSize. Dividing BlkMaxSize by the Logical Page Number (LPN) of the corresponding data Page, and recording the result as the Number of the cache block to which the data Page belongs, wherein the corresponding remainder is the offset of the cache block.
The write buffer area is used for caching modified data pages (dirty pages) after responding to the write request, and the data pages of the buffer area form a queue for management according to an LRU principle; meanwhile, the data pages in the buffer area are divided into cold pages and hot pages, the data pages in the first half are hot pages, and the data pages in the second half are cold pages.
The read buffer is used for buffering data pages (clean pages) which are not modified only in response to read requests, and the data pages of the buffer are also managed by an LRU queue. The data page in the buffer will be migrated to the write buffer after responding to the write request, and similarly, the hot data page in the write buffer will also be migrated to the read buffer when the write back occurs.
As shown in FIG. 2, the queue size of the read/write buffers changes due to the dynamic selection of the replacement object during the replacement process.
And carrying out cycle statistics on the hit condition of the read-write buffer, the bottom layer read-write delay, the write-back times of the buffer and the update-write times of the bottom layer data page.
Recording a read hit statistical variable of a write buffer area in a fixed observation period as DRH, and recording a write hit statistical variable of the write buffer area as DWH; recording a read hit statistical variable of the read buffer as CRH, and recording a write hit statistical variable of the read buffer as CWH; the number of write back times of the cache region in the period is recorded as Bw, and the number of write operation times of the flash memory in the period is recorded as Fw; the write delay in this cycle is denoted as WriteDelay and the read delay is denoted as ReadDelay.
When the data page of the write buffer is selected as a replacement object and written back to the flash memory, the self-adaptive clustering write-back mechanism is triggered.
As shown in fig. 3, in the adaptive clustering write-back mechanism, a write-back cache block is determined from a replacement data page, and a set of written-back dirty pages is determined by using record information of D-list-index in the cache block record while a hot dirty page is retained. And in the cluster write-back process, dynamically selecting whether to adopt page filling according to the current write amplification factor. The operation process is as follows:
s61, selecting the data page V of the write buffer LRU position as the elimination object, inquiring the D-list-index information in the cache record block corresponding to the data page, and then executing S62.
S62, data pages pointed by the position pointer of the D-list-index are sequentially read, the data pages are judged according to the principle that the data pages positioned at the front half part of the buffer queue are hot data, the data pages judged to be hot are added into the reserved set phi, and then S63 is executed.
S63, calculating the current write back threshold value
Figure BDA0001613820660000061
Wherein the content of the first and second substances,
Figure BDA0001613820660000062
and then S64 is executed.
S64, calculating the filling page number E ═ BlkMaxSize-N, wherein N is the number of data pages of the current recording block in the writing buffer area, and then comparing the sizes of E and Th; if E is less than or equal to Th, executing S65; otherwise, S66 is executed.
And S65, enabling page filling, reading the E filling pages from the bottom layer flash memory and writing back the dirty pages to form a whole data block and writing back the whole data block into the bottom layer flash memory, and then executing S67.
S66, not starting page filling, writing all dirty pages in the D-list-index back to the bottom layer flash memory, and executing S67.
S67, all data pages in the aggregate phi are moved into a read buffer area, meanwhile, the position information of the D-list-index in the cache block record table of the original data block is deleted, meanwhile, the new position pointer after the transfer is stored into the C-list-index, and finally, the clustering write-back operation is finished.
In the management method proposed by the present invention, when a data page is replaced, a replacement buffer object is selected by comparing a threshold Tau (the size of a current target read buffer) with the size of a current read buffer. The threshold Tau will integrate the hit condition of the current read-write buffer and the read-write delay of the bottom layer, and perform periodic adjustment, the threshold adjustment mechanism is shown in fig. 4, and the process is as follows:
s81, judging whether the current request is hit, if yes, executing S82, otherwise, executing S83;
s82, judging the request type and the hit area, if the read buffer area hits, adding 1 to CRH; if the read buffer write hits, then CWH adds 1; if the write buffer area is read hit, DRH adds 1; if the write buffer zone is hit, adding 1 to CRH; finally, executing S83;
s83, updating the current TCount, that is, TCount +1, and updating the statistical value Bw and the statistical value Fw, and then executing S84;
s84, judging whether TCount reaches the threshold updating cycle cycleTime, if so, executing S85, otherwise, ending the threshold updating operation;
wherein, CRH is the read hit statistical variable of the read buffer, CWH is the write hit statistical variable of the read buffer; DRH is a read hit statistical variable of a write buffer area, and DWH is a write hit statistical variable of the write buffer area; TCount is the current request operation count; the CycleTime is a threshold updating period;
s85, calculating a target write buffer unity gain DR, a target read buffer unity gain CR:
Figure BDA0001613820660000071
wherein BufSize is the size of the total read-write buffer, Tau' is the threshold before updating,
cr and Cw are normalized to obtain a read-write delay cost coefficient:
Figure BDA0001613820660000072
wherein, ReadDelay and WriteDelay are read delay and write delay in a period respectively; and then S86 is executed.
S86, update threshold Tau:
Figure BDA0001613820660000073
and simultaneously updating the write-back frequency statistic Bw of the period buffer area to be 0, the period flash memory write operation frequency statistic Fw to be 0, the period count value TCount to be 1, and finally ending the updating operation of the threshold Tau.
As shown in fig. 5, the general flow of request processing of the present invention includes the following steps:
s1, when a request P arrives, the corresponding cache block number pBlkNum is found out according to the conversion of the LPN number of the request P, whether the cache block number exists in the cache block record table is inquired, if so, S2 is executed, otherwise, S4 is executed;
s2, traversing the position pointer in the cache block record table entry, inquiring whether the request P exists in the buffer area, if so, executing S3, otherwise, executing S5;
s3, interpreting the position of the buffer area where the requested data page is located, moving the hit data page to the MRU position of the corresponding buffer area, updating the position pointer list in the record table entry of the corresponding buffer block, removing the old pointer pointing to the data page, and storing the new pointer pointing to the position of the data page; then executing S8;
s4, adding number pBlkNum cache block table entry information into the cache block record table, initializing BlkNum ═ pBlkNum, BlkSize ═ 0, and executing S5 after D-list-index and C-list-index are null;
s5, judging whether the current buffer area is full, if so, executing S6, otherwise, executing S7;
s6, comparing the size of the current read buffer area with the size of the threshold Tau, if so, selecting the data page at the LRU position of the read buffer area to remove; otherwise, selecting the data page at the LRU position of the write buffer area as a replacement buffer area, and executing a self-adaptive clustering write-back mechanism; finding an old position pointer pointing to the removed data page from the C-list-index or D-list-index list, removing the old position pointer, and updating BlkSize of the corresponding recording block to BlkSize-1; thereafter, S7 is executed;
s7, reading the missing request data page from the flash memory into a buffer area, and simultaneously interpreting the request type; if the data page is a read request, loading the data page into a read buffer area, and simultaneously storing a pointer pointing to the position of the data page into a C-list-index of a cache block record; otherwise, loading the data page into a write buffer zone, and simultaneously storing the position pointer into the D-list-index of the corresponding buffer block record; then, update BlkSize ═ BlkSize +1 in the cache record table, and then execute S8;
and S8, starting the period threshold Tau, carrying out period adjustment on the threshold Tau, and finally ending the processing of the request.
In step S3, the step of updating the location pointer list in the corresponding cache block record table specifically includes:
s31, judging the position of the buffer area where the requested data page is located, and if the requested data page is the write buffer area, executing S32; if it is the read buffer, go to S33;
s32, moving the hit data page to the MRU position of the write buffer area, updating the D-list-index in the corresponding buffer block record table entry, removing the old pointer pointing to the data page, and storing the new pointer pointing to the data page position into the D-list-index; then executing S8;
s33, moving the hit data page to the MRU position of the read buffer area, updating the corresponding C-list-index, eliminating the old pointer pointing to the data page, and storing the new position pointer into the C-list-index; and then S8 is executed.
For further explanation of the processing flow of the management method of the present invention, a specific set of actual request processing examples is described, and the processing procedure of the example is shown in fig. 6.
In this example, the data block size is 4 data pages, the buffer size is 10 data pages, the read/write delay ratio is fixed to W/R4/1, the write amplification factor is constant to W1.5, the threshold update period is 10, the current period count value TCount is 1, and the initial value of the threshold Tau is 5.
In the present example, the request sequence is as shown in fig. 6, and consists of the logical address of the request and the request type, e.g. (R, 20), representing a read request with an access data page LPN of 20.
In this example, the process flow for the first request (R, 20):
c1, obtaining the buffer block number pBlkNum 20/4 ═ 5 according to the LPN conversion, and querying whether the record information of the buffer block number exists in the buffer block record table.
And C2, loading a record table entry of which pBlkNum is 5 into the cache block record table when the information of the cache block does not exist, and updating the block number BlkNum of the table entry which BlkSize is 0 and the C-list-index and the D-list-index are null.
C3, load request page into buffer, find buffer full, compare read buffer size RL (4) with current threshold Tau (5), and select write buffer LRU position LPN 13 as replacement object.
C4, replacement page (LPN 13) belongs to buffer block VBlkNum 13/4 equal to 3, dirty page LPN 14 belonging to the buffer block is reserved for hot requirement, current write back threshold value
Figure BDA0001613820660000081
Get
2 for integer, fill page is 2, select monoblock to write back, and read the buffer area and include other data pages, do not need extra reading operation, the direct monoblock writes back can.
C5, setting the D-list-index in the 3 buffer block with VBlkNum to be empty, moving the data page with LPN to be 14 to the tail part of the read buffer queue, and storing the position pointer pointing to the data page into the C-list-index
C6, loading the request into buffer, judging the request as read type, loading the data page with LPN-20 into MRU position of read buffer, storing the position pointer into C-list-index with pBlkNum-20/4-5, and updating BlkSize-1
And C7, starting the updating of the period threshold Tau, wherein the period count value TCount is accumulated to be 2 because of missing the request, and the TCount is judged to be less than the updating period cycleTime, so that the updating adjustment is directly finished, and the operation of the request is finished.
In this example, the process flow for the second request (W, 1):
c8, obtaining the cache block number pBlkNum 1/4 ═ 0 according to the LPN conversion, and querying whether the record information of the cache block number exists in the cache block record table.
C9, traversing the cache block C-list-index to find that the data page with LPN 1 is in the read buffer
C10, judging the type of the request is write request, moving the data page from the read buffer to the MRU position of the write buffer, clearing the position pointer of the C-list-index, storing the new position pointer of the data page into the D-list-index of the buffer block record table
C11, starting the updating of the period threshold Tau, because it is the write hit of the read buffer, the statistical value CWH is accumulated, then the period count value TCount is accumulated to 3, and the adjustment is finished after the update period is not reached, and the operation of this request is finished.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (8)

1. A replacement and write-back self-adaptive buffer management method,
the buffer area is divided into a buffer block record table, a write buffer area and a read buffer area;
the cache block record table is used for recording the position information of data pages belonging to the same logical data block in a buffer area, the write buffer area is used for caching the data pages which are modified in response to a write request, and the read buffer area is used for caching the data pages which are only in response to a read request and are not modified; it is characterized in that the preparation method is characterized in that,
the management method comprises the following steps:
s1, when the access request comes, inquiring whether the cache block record table contains the cache block information corresponding to the request, if yes, executing S2, otherwise, executing S4;
s2, inquiring whether a position pointer pointing to the requested data page exists in the cache block record table, if so, executing S3, otherwise, executing S5;
s3, migrating the hit data page to the MRU position of the corresponding buffer area, wherein the MRU refers to the nearest access end; updating a position pointer list in a corresponding cache block record table; then executing S8;
s4, adding corresponding record block information to the buffer block record table, initializing all information of the record block, and then executing S5;
s5, judging whether the current buffer area is full; if yes, executing S6, otherwise, executing S7;
s6, comparing the size of the read buffer with a target threshold Tau; if so, selecting the data page at the LRU position of the read buffer area to be removed, otherwise, selecting the data page at the LRU position of the write buffer area as a removal item and executing self-adaptive cluster write-back; updating record block information corresponding to the removed data page, and then executing S7;
s7, loading the missing request data page into the corresponding buffer area, adding the position pointer pointing to the data page into the position pointer list of the corresponding cache block record table, and updating the corresponding record block information; then executing S8;
s8, starting a replacement strategy threshold value adjusting mechanism to adjust the threshold value Tau; and finally, ending the processing of the request.
2. The method of permute and write back adaptive buffer management according to claim 1,
and the read buffer area and the write buffer area adopt LRU management queues, and when the buffer area hits requests and loads new data pages, the hit requests and the loaded new data pages are migrated to the MRU position of the queues.
3. The method of permute and write back adaptive buffer management according to claim 1,
in the cache block record table, the information of one record block includes: the number BlkNum of the cache block, the number BlkSize of data pages belonging to the same record block in the buffer area, a clean page position pointer list C-list-index belonging to the same record block and a dirty page position pointer list D-list-index belonging to the same record block.
4. The method of permute and write back adaptive buffer management according to claim 3,
in step S3, the step of updating the location pointer list in the corresponding cache block record table specifically includes:
removing an old position pointer pointing to the migration data page from the C-list-index or D-list-index list, then judging a migration position, and if the migration position is migrated into the read buffer area, storing the position pointer into the corresponding C-list-index in the cache block; otherwise, the position pointer of the data page is stored into the D-list-index in the record block.
5. The method of permute and write back adaptive buffer management according to claim 3,
in step S6, the updating and removing the recording block information corresponding to the data page specifically includes:
and finding an old position pointer pointing to the removed data page from the C-list-index or D-list-index list, removing the old position pointer, and updating the BlkSize of the corresponding recording block to be BlkSize-1.
6. The method of permute and write back adaptive buffer management according to claim 3,
in step S7, the adding the position pointing to the data page to the position pointer list of the corresponding cache block record table, and updating the corresponding record block information specifically includes:
judging the type of the request, and if the request is a read request, storing the position pointer of the newly added data page into the corresponding cache record block C-list-index; otherwise, the position pointer of the data page is stored in the D-list-index of the recording block, and then the BlkSize of the corresponding recording block is updated to be BlkSize + 1.
7. The method of permute and write back adaptive buffer management according to claim 1,
in step S6, the adaptive clustering write-back process includes:
s61, selecting the data page at the position of the write buffer LRU as a removal object, inquiring the D-list-index information in the cache record block corresponding to the data page, and then executing S62;
s62, sequentially reading data pages pointed by the position pointers of the D-list-index, judging the data pages pointed by the position pointers of the D-list-index according to the principle that the data pages positioned at the front half part of the cache queue are hot data, adding the data pages judged to be hot into the reserved set phi, and then executing S63;
s63, calculating the current write amplification factor
Figure FDA0002588007460000021
Calculating the current write back threshold according to the current write amplification factor W
Figure FDA0002588007460000022
Wherein Bw is a statistical value of write-back times of the cache region in a fixed period; fw is a flash memory write operation frequency counting value in a fixed period; BlkMaxSize is the logical data block size, t is a constant coefficient; then executing S64;
s64, calculating the filling page number E ═ BlkMaxSize-N, wherein N is the number of data pages of the current recording block in the writing buffer area, and then comparing the sizes of E and Th; if E is less than or equal to Th, executing S65; otherwise, go to S66;
s65, starting page filling, reading E filling pages from the bottom layer flash memory and writing back dirty pages to form a whole data block and writing back the whole data block into the bottom layer flash memory; then executing S67;
s66, not starting page filling, completely writing back the dirty pages in the D-list-index into the bottom layer flash memory, and executing S67;
s67, all data pages in the aggregate phi are moved to a read buffer area, the position information of the D-list-index in a cache block record table of an original data block is deleted, and a new position pointer after transfer is stored in the C-list-index; and finally ending the cluster write-back operation.
8. The method for replacement and write-back adaptive buffer management according to claim 7,
in step S8, the starting of the replacement policy threshold adjustment mechanism adjusts the threshold Tau, and the specific adjustment process is as follows:
s81, judging whether the current request is hit, if yes, executing S82, otherwise, executing S83;
s82, judging the request type and the hit area, if the read buffer area hits, adding 1 to CRH; if the read buffer write hits, then CWH adds 1; if the write buffer area is read hit, DRH adds 1; if the write buffer zone is hit, adding 1 to CRH; finally, executing S83;
s83, updating the current TCount, that is, TCount +1, and updating the statistical value Bw and the statistical value Fw, and then executing S84;
s84, judging whether TCount reaches the threshold updating cycle cycleTime, if so, executing S85, otherwise, ending the updating operation of the threshold Tau;
wherein, CRH is the read hit statistical variable of the read buffer, CWH is the write hit statistical variable of the read buffer; DRH is a read hit statistical variable of a write buffer area, and DWH is a write hit statistical variable of the write buffer area; TCount is the current request operation count; the CycleTime is a threshold updating period;
s85, calculating a target write buffer unity gain DR, a target read buffer unity gain CR:
Figure FDA0002588007460000031
wherein BufSize is the size of the total read-write buffer, Tau' is the threshold before updating,
cr and Cw are normalized to obtain a read-write delay cost coefficient:
Figure FDA0002588007460000032
wherein, ReadDelay and WriteDelay are read delay and write delay in a period respectively; then executing S86;
s86, update threshold Tau:
Figure FDA0002588007460000033
and simultaneously updating the write-back frequency statistic Bw of the period buffer area to be 0, the period flash memory write operation frequency statistic Fw to be 0, the period count value TCount to be 1, and finally ending the updating operation of the threshold Tau.
CN201810276887.5A 2018-03-30 2018-03-30 Replacement and write-back self-adaptive buffer area management method Active CN108845957B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810276887.5A CN108845957B (en) 2018-03-30 2018-03-30 Replacement and write-back self-adaptive buffer area management method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810276887.5A CN108845957B (en) 2018-03-30 2018-03-30 Replacement and write-back self-adaptive buffer area management method

Publications (2)

Publication Number Publication Date
CN108845957A CN108845957A (en) 2018-11-20
CN108845957B true CN108845957B (en) 2020-10-09

Family

ID=64211896

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810276887.5A Active CN108845957B (en) 2018-03-30 2018-03-30 Replacement and write-back self-adaptive buffer area management method

Country Status (1)

Country Link
CN (1) CN108845957B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109857680B (en) * 2018-11-21 2020-09-11 杭州电子科技大学 LRU flash memory cache management method based on dynamic page weight
CN109783019B (en) * 2018-12-28 2022-08-19 上海威固信息技术股份有限公司 Intelligent data storage management method and device
CN110888600B (en) * 2019-11-13 2021-02-12 西安交通大学 Buffer area management method for NAND flash memory
CN113722245B (en) * 2021-08-04 2023-12-12 广州市百果园信息技术有限公司 Buffer self-adaptive adjustment method, device, equipment and storage medium
CN116821174A (en) * 2023-07-17 2023-09-29 深圳计算科学研究院 Data query method and device based on logic data block

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106528454A (en) * 2016-11-04 2017-03-22 中国人民解放军国防科学技术大学 Memory system cache mechanism based on flash memory
CN107589908A (en) * 2017-08-17 2018-01-16 暨南大学 The merging method that non-alignment updates the data in a kind of caching system based on solid-state disk
CN107590084A (en) * 2017-08-22 2018-01-16 浙江万里学院 A kind of page level buffering area improved method based on classification policy

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4194559B2 (en) * 2002-09-26 2008-12-10 エルジー エレクトロニクス インコーポレーテッド Method and apparatus for managing defective area on optical disc and write once optical disc
US6891690B2 (en) * 2002-11-20 2005-05-10 International Business Machines Corporation On-drive integrated sector format raid error correction code system and method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106528454A (en) * 2016-11-04 2017-03-22 中国人民解放军国防科学技术大学 Memory system cache mechanism based on flash memory
CN107589908A (en) * 2017-08-17 2018-01-16 暨南大学 The merging method that non-alignment updates the data in a kind of caching system based on solid-state disk
CN107590084A (en) * 2017-08-22 2018-01-16 浙江万里学院 A kind of page level buffering area improved method based on classification policy

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Optimizing pipeline for a RISC processor with multimedia extension ISA;XIAO Zhi-bin,etc.;《Journal of Zhejiang University SCIENCE A》;20061231;第7卷(第2期);全文 *
缓冲区管理层对固态盘的有效性研究;杜晨杰,李君,姚英彪;《浙江万里学院学报》;20170331;第30卷(第2期);第72-76页 *

Also Published As

Publication number Publication date
CN108845957A (en) 2018-11-20

Similar Documents

Publication Publication Date Title
CN108845957B (en) Replacement and write-back self-adaptive buffer area management method
US11893238B2 (en) Method of controlling nonvolatile semiconductor memory
KR101894625B1 (en) Priority-based garbage collection for data storage systems
US9342458B2 (en) Cache allocation in a computerized system
CN108762664B (en) Solid state disk page-level cache region management method
US10740251B2 (en) Hybrid drive translation layer
CN107943719B (en) Flash translation layer control method based on request classification
CN103257935B (en) A kind of buffer memory management method and application thereof
CN109446117B (en) Design method for page-level flash translation layer of solid state disk
CN110413537B (en) Flash translation layer facing hybrid solid state disk and conversion method
CN105389135B (en) A kind of solid-state disk inner buffer management method
CN107423229B (en) Buffer area improvement method for page-level FTL
US10635581B2 (en) Hybrid drive garbage collection
US20090094391A1 (en) Storage device including write buffer and method for controlling the same
KR101297442B1 (en) Nand flash memory including demand-based flash translation layer considering spatial locality
KR20100115090A (en) Buffer-aware garbage collection technique for nand flash memory-based storage systems
CN108762671A (en) Mixing memory system and its management method based on PCM and DRAM
CN111352593B (en) Solid state disk data writing method for distinguishing fast writing from normal writing
CN111580754B (en) Write-friendly flash memory solid-state disk cache management method
CN111506517B (en) Flash memory page level address mapping method and system based on access locality
KR101191650B1 (en) Apparatus and method for mapping the data address in NAND flash memory
US10579541B2 (en) Control device, storage system and method
KR101353967B1 (en) Data process method for reading/writing data in non-volatile memory cache having ring structure
KR20100099888A (en) A method for log management in flash memory-based database systems
CN109857680B (en) LRU flash memory cache management method based on dynamic page weight

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