CN105760225B - A kind of method for recovering internal storage and system - Google Patents
A kind of method for recovering internal storage and system Download PDFInfo
- Publication number
- CN105760225B CN105760225B CN201610056312.3A CN201610056312A CN105760225B CN 105760225 B CN105760225 B CN 105760225B CN 201610056312 A CN201610056312 A CN 201610056312A CN 105760225 B CN105760225 B CN 105760225B
- Authority
- CN
- China
- Prior art keywords
- cache
- recovery time
- memory recycle
- slab
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 31
- 238000003860 storage Methods 0.000 title claims abstract description 22
- 230000015654 memory Effects 0.000 claims abstract description 75
- 238000011084 recovery Methods 0.000 claims abstract description 40
- 238000004064 recycling Methods 0.000 claims abstract description 34
- 238000010586 diagram Methods 0.000 description 3
- 238000006062 fragmentation reaction Methods 0.000 description 2
- 239000002699 waste material Substances 0.000 description 2
- 241000208340 Araliaceae Species 0.000 description 1
- 235000005035 Panax pseudoginseng ssp. pseudoginseng Nutrition 0.000 description 1
- 235000003140 Panax quinquefolius Nutrition 0.000 description 1
- 238000000151 deposition Methods 0.000 description 1
- 238000009826 distribution Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000013467 fragmentation Methods 0.000 description 1
- 235000008434 ginseng Nutrition 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 239000003550 marker Substances 0.000 description 1
- 238000002360 preparation method Methods 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5022—Mechanisms to release resources
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/0223—User address space allocation, e.g. contiguous or non contiguous base addressing
- G06F12/023—Free address space management
- G06F12/0253—Garbage collection, i.e. reclamation of unreferenced memory
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/50—Indexing scheme relating to G06F9/50
- G06F2209/503—Resource availability
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Memory System Of A Hierarchy Structure (AREA)
Abstract
The invention discloses a kind of method for recovering internal storage and systems, judge whether cache is placed with and exempts from recycling mark, when the cache, which is not placed, exempts from recycling mark, judge whether the cache is used in the default recovery time section of continuous preset times, when the cache is not used by the default recovery time section of continuous preset times, Memory recycle then is carried out to the cache, when cache, which is not placed, exempts from recycling mark, the judgement of recycling condition is not carried out according to slab Memory recycle strategy directly, but further judge whether high-speed internal memory is used in continuous recovery time, Memory recycle is carried out to it if being not used by, slab Memory recycle can be optimized, save kernel storage resource.
Description
Technical field
The present invention relates to Installed System Memories to optimize field, more particularly to a kind of method for recovering internal storage and system.
Background technique
Slab is a kind of Memory Allocation mechanism of (SuSE) Linux OS, and work is for some frequent distribution and to discharge
Object, such as process descriptors, the size of these objects is generally smaller, if directlying adopt buddy system to be allocated
And release, a large amount of memory fragmentation is not only resulted in, and processing speed is too slow.And slab distributor is carried out based on object
Management, the object of same type is classified as a kind of (such as process descriptors are exactly one kind), whenever applying for such a object,
Slab distributor just distributes a this level of unit from a slab list and goes out, and when to be discharged, again by it
It saves in the list, rather than is directly returned to buddy system, to avoid these memory fragmentations.
Slab distributor does not abandon allocated object, but discharges and they are saved in memory.When later again
When asking the object looked for novelty, so that it may be directly acquired from memory and not have to repeat to initialize.But it is long-term not used slow in this way
Kernel resources can be occupied by depositing, and cause the waste of kernel storage resource.
Summary of the invention
In view of this, the main purpose of the present invention is to provide a kind of method for recovering internal storage and system, it can be in slab
It is stored back to receipts to optimize, avoids the waste of kernel storage resource.
To achieve the above object, the present invention provides a kind of method for recovering internal storage, comprising:
Judge whether cache is placed with and exempts from recycling mark;
When the cache, which is not placed, exempts from recycling mark, judge the cache in the pre- of continuous preset times
If whether being used in recovery time section;
When the cache is not used by the default recovery time section of continuous preset times, then to the high speed
Caching carries out Memory recycle.
Preferably, carrying out Memory recycle to the cache includes:
The memory for emptying the cache empties the idle object pointer in idle object pointer alignment, and destroys
Slab state is the slab subregion in empty queue.
Preferably, after judging whether the cache is used in the default recovery time section of continuous preset times
Further include:
When the cache is used in the default recovery time section of continuous preset times, then according to slab memory
Take-back strategy handles the cache.
Preferably, carrying out processing to the cache according to slab Memory recycle strategy includes:
When reaching default recovery time section, Memory recycle is carried out to the cache.
The present invention also provides a kind of Memory recycle systems, comprising:
First judgment module exempts from recycling mark for judging whether cache is placed with;
Second judgment module, for when the cache do not place exempt from recycling mark when, judge that the cache exists
Whether used in the default recovery time section of continuous preset times;
First Memory recycle module, for when the cache is in the default recovery time section of continuous preset times
It is not used by, then Memory recycle is carried out to the cache.
Preferably, the first Memory recycle module is specifically used for:
When the cache is not used by the default recovery time section of continuous preset times, the high speed is emptied
The memory of caching empties the idle object pointer in idle object pointer alignment, and destroying slab state is in empty queue
Slab subregion.
Preferably, the Memory recycle system further include:
Second Memory recycle module, for when the cache is in the default recovery time section of continuous preset times
It is used, then the cache is handled according to slab Memory recycle strategy.
Preferably, the second Memory recycle module is specifically used for:
When the cache is used in the default recovery time section of continuous preset times and reaches default recycling
When the period, Memory recycle is carried out to the cache.
Using a kind of method for recovering internal storage provided by the invention and system, judges whether cache is placed with and exempt from recycling mark
Will judges cache the presetting back in continuous preset times when the cache, which is not placed, exempts from recycling mark
It receives and whether is used in the period, when the cache is not made in the default recovery time section of continuous preset times
With then to cache progress Memory recycle, when cache, which is not placed, exempts from recycling mark, not directly according in slab
The judgement that take-back strategy carries out recycling condition is deposited, but further judges whether high-speed internal memory is made in continuous recovery time
With carrying out Memory recycle to it if being not used by, can optimize slab Memory recycle, save kernel storage resource.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
The embodiment of invention for those of ordinary skill in the art without creative efforts, can also basis
The attached drawing of offer obtains other attached drawings.
Fig. 1 is a kind of flow chart of method for recovering internal storage embodiment of the present invention;
Fig. 2 is a kind of flow chart of the another embodiment of method for recovering internal storage of the present invention;
Fig. 3 is a kind of structural schematic diagram of Memory recycle system embodiment of the present invention;
Fig. 4 is a kind of structural schematic diagram of the another embodiment of Memory recycle system of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
The present invention provides a kind of method for recovering internal storage, Fig. 1 shows the process of method for recovering internal storage embodiment of the present invention
Figure, comprising:
Step S101: judge whether cache is placed with and exempt from recycling mark, if it is not, then entering step S102;
Judge in cache exempt from recycle flag bit whether set.
Step S102: judge whether the cache is made in the default recovery time section of continuous preset times
With if it is not, then entering step S103;
When the cache, which is not placed, exempts from recycling mark, judge cache in the recycling of continuous preset times
Between whether be previously used in section, it is recovery time (reap_time) that cache, which has a flag bit, is generally preset as 4 seconds, i.e.,
The Memory recycle of the cache last time and this Memory recycle interval 4 seconds then judge that high speed is slow if preset times are 3 times
Whether there are be previously used in continuous 3 recovery time sections.
Step S103: Memory recycle is carried out to the cache.
When the cache is not used by the default recovery time section of continuous preset times, then to cache
Idle page frame recycling is carried out, i.e., is idle carry out Memory recycle to page frame state, empties the memory of the cache, empty
Idle object pointer in idle object pointer alignment, and slab subregion all in the queue of slabs_empty is destroyed,
Slabs_empty is that slab state is empty queue, by disposably taking out large quantities of objects from multiple slab subregions, at this time
The work of update idle object concordance list, transfer queue is completed, the pointer of these objects is just stored in " idle object pointer team
Column ", when taking every time afterwards by the method or go back object, can directly operate this queue, to improve efficiency.
Using a kind of method for recovering internal storage provided in this embodiment, judges whether cache is placed with and exempts from recycling mark,
When the cache, which is not placed, exempts from recycling mark, judge the cache in the default recycling of continuous preset times
Between whether used in section, when the cache is not used by the default recovery time section of continuous preset times, then
Memory recycle is carried out to the cache, when cache, which is not placed, exempts from recycling mark, not directly according to being stored back in slab
It receives strategy and carries out the judgement of recycling condition, but further judge whether high-speed internal memory is used in continuous recovery time,
Memory recycle is carried out to it if being not used by, slab Memory recycle can be optimized, saves kernel storage resource.
Fig. 2 shows the flow charts of the another embodiment of method for recovering internal storage of the present invention, correspond to Fig. 1, further includes:
Step S104: when the cache is used in the default recovery time section of continuous preset times, then root
The cache is handled according to slab Memory recycle strategy.
Slab Memory recycle strategy need to meet two conditions and then carry out idle page frame Memory recycle to cache: (1) full
Sufficient recovery time;(2) " exempt from recycle flag bit " in the cache be without set, has currently judged that cache is exempted to recycle
The non-set of marker then carries out Memory recycle to cache when reaching preset recovery time section.
The present invention also provides a kind of Memory recycle system, Fig. 3 shows the knot of Memory recycle system embodiment of the present invention
Structure schematic diagram, comprising:
First judgment module 101 exempts from recycling mark for judging whether cache is placed with;
Second judgment module 102, for when the cache do not place exempt from recycling mark when, judge the cache
Whether used in the default recovery time section of continuous preset times;
First Memory recycle module 103, for when the cache is in the default recovery time of continuous preset times
It is not used by section, then Memory recycle is carried out to the cache.
The first Memory recycle module 103 is specifically used in the present embodiment:
When the cache is not used by the default recovery time section of continuous preset times, the high speed is emptied
The memory of caching empties the idle object pointer in idle object pointer alignment, and destroying slab state is in empty queue
Slab subregion.
As shown in figure 4, Memory recycle system embodiment of the present invention may also include that
Second Memory recycle module 104, for when the cache is in the default recovery time of continuous preset times
It is used, then the cache is handled according to slab Memory recycle strategy in section.
The second Memory recycle module 104 is specifically used for:
When the cache is used in the default recovery time section of continuous preset times and reaches default recycling
When the period, Memory recycle is carried out to the cache.
Using a kind of Memory recycle system provided in this embodiment, judges whether cache is placed with and exempts from recycling mark,
When the cache, which is not placed, exempts from recycling mark, judge the cache in the default recycling of continuous preset times
Between whether used in section, when the cache is not used by the default recovery time section of continuous preset times, then
Memory recycle is carried out to the cache, when cache, which is not placed, exempts from recycling mark, not directly according to being stored back in slab
It receives strategy and carries out the judgement of recycling condition, but further judge whether high-speed internal memory is used in continuous recovery time,
Memory recycle is carried out to it if being not used by, slab Memory recycle can be optimized, saves kernel storage resource.
It should be noted that all the embodiments in this specification are described in a progressive manner, each embodiment weight
Point explanation is the difference from other embodiments, and the same or similar parts between the embodiments can be referred to each other.
For system class embodiment, since it is basically similar to the method embodiment, so being described relatively simple, related place ginseng
See the part explanation of embodiment of the method.
Finally, it is to be noted that, herein, relational terms such as first and second and the like be used merely to by
One entity or operation are distinguished with another entity or operation, without necessarily requiring or implying these entities or operation
Between there are any actual relationship or orders.Moreover, the terms "include", "comprise" or its any other variant meaning
Covering non-exclusive inclusion, so that the process, method, article or equipment for including a series of elements not only includes that
A little elements, but also including other elements that are not explicitly listed, or further include for this process, method, article or
The intrinsic element of equipment.In the absence of more restrictions, the element limited by sentence "including a ...", is not arranged
Except there is also other identical elements in the process, method, article or apparatus that includes the element.
Method and system provided by the present invention is described in detail above, specific case used herein is to this
The principle and embodiment of invention is expounded, method of the invention that the above embodiments are only used to help understand and
Its core concept;At the same time, for those skilled in the art in specific embodiment and is answered according to the thought of the present invention
With in range, there will be changes, in conclusion the contents of this specification are not to be construed as limiting the invention.
Claims (6)
1. a kind of method for recovering internal storage characterized by comprising
Judge whether cache is placed with and exempts from recycling mark;
When the cache, which is not placed, exempts from recycling mark, cache the presetting back in continuous preset times is judged
It receives and whether is used in the period;
When the cache is not used by the default recovery time section of continuous preset times, then it is slow to empty the high speed
The memory deposited empties the idle object pointer in idle object pointer alignment, and destroying slab state is in empty queue
Slab subregion.
2. method for recovering internal storage according to claim 1, which is characterized in that judge that the cache is continuously being preset
After whether being used in the default recovery time section of number further include:
When the cache is used in the default recovery time section of continuous preset times, then according to slab Memory recycle
Strategy handles the cache.
3. method for recovering internal storage according to claim 2, which is characterized in that according to slab Memory recycle strategy to the height
Speed caching carries out processing
When reaching default recovery time section, Memory recycle is carried out to the cache.
4. a kind of Memory recycle system characterized by comprising
First judgment module exempts from recycling mark for judging whether cache is placed with;
Second judgment module, for when the cache do not place exempt from recycling mark when, judge the cache continuous
Preset times default recovery time section in whether used;
First Memory recycle module, for when the cache in the default recovery time section of continuous preset times not by
It uses, empties the memory of the cache, empty the idle object pointer in idle object pointer alignment, and destroy slab shape
State is the slab subregion in empty queue.
5. Memory recycle system according to claim 4, which is characterized in that further include:
Second Memory recycle module, for being made in the default recovery time section of continuous preset times when the cache
With then being handled according to slab Memory recycle strategy the cache.
6. Memory recycle system according to claim 5, which is characterized in that the second Memory recycle module is specifically used
In:
When the cache is used in the default recovery time section of continuous preset times and reaches default recovery time
Duan Shi carries out Memory recycle to the cache.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610056312.3A CN105760225B (en) | 2016-01-27 | 2016-01-27 | A kind of method for recovering internal storage and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610056312.3A CN105760225B (en) | 2016-01-27 | 2016-01-27 | A kind of method for recovering internal storage and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105760225A CN105760225A (en) | 2016-07-13 |
CN105760225B true CN105760225B (en) | 2019-05-10 |
Family
ID=56342609
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610056312.3A Active CN105760225B (en) | 2016-01-27 | 2016-01-27 | A kind of method for recovering internal storage and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105760225B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109992402B (en) | 2017-12-29 | 2021-07-09 | Oppo广东移动通信有限公司 | Memory processing method and device, electronic equipment and computer readable storage medium |
CN110968266B (en) * | 2019-11-07 | 2021-03-26 | 华中科技大学 | Storage management method and system based on heat degree |
CN113986540B (en) * | 2021-10-25 | 2024-05-10 | 苏州浪潮智能科技有限公司 | Method and device for regularly recycling linux cache |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102567208A (en) * | 2010-12-08 | 2012-07-11 | 上海杉达学院 | Memory recovery method applicable to enterprise publicity website |
CN103197979A (en) * | 2012-01-04 | 2013-07-10 | 阿里巴巴集团控股有限公司 | Method and device for realizing data interaction access among processes |
CN103678172A (en) * | 2013-12-25 | 2014-03-26 | Tcl集团股份有限公司 | Local data cache management method and device |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9195578B2 (en) * | 2012-08-24 | 2015-11-24 | International Business Machines Corporation | Systems, methods and computer program products memory space management for storage class memory |
-
2016
- 2016-01-27 CN CN201610056312.3A patent/CN105760225B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102567208A (en) * | 2010-12-08 | 2012-07-11 | 上海杉达学院 | Memory recovery method applicable to enterprise publicity website |
CN103197979A (en) * | 2012-01-04 | 2013-07-10 | 阿里巴巴集团控股有限公司 | Method and device for realizing data interaction access among processes |
CN103678172A (en) * | 2013-12-25 | 2014-03-26 | Tcl集团股份有限公司 | Local data cache management method and device |
Non-Patent Citations (1)
Title |
---|
多核***内存管理算法的研究;杨新波;《中国优秀硕士学位论文全文数据库 信息科技辑》;20120515;I137-42 |
Also Published As
Publication number | Publication date |
---|---|
CN105760225A (en) | 2016-07-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105760225B (en) | A kind of method for recovering internal storage and system | |
CN103067425B (en) | Virtual machine creation method, virtual machine management system and relevant device | |
CN100382048C (en) | A managing method for EMS memory | |
CN102576330B (en) | Memory system having persistent garbage collection | |
CN101859279B (en) | Memory allocation and release method and device | |
CN101918913A (en) | Reclaiming storage on a thin-provisioning storage device | |
CN101594302B (en) | Method and device for dequeuing data | |
CN101122883A (en) | Memory allocation method for avoiding RAM fragmentation | |
CN103678172B (en) | Local data cache management method and device | |
CN103577158B (en) | Data processing method and device | |
CN103514102A (en) | Memory garbage collecting method and device for Java virtual machine | |
CN101470665A (en) | Method and system for internal memory management of application system without MMU platform | |
CN101320351A (en) | Internal memory distribution, cleaning and releasing method, and internal memory management apparatus | |
CN107783812B (en) | Virtual machine memory management method and device | |
CN107018172A (en) | System and method for the adaptive partition in distributed caching memory | |
CN104573119A (en) | Energy-saving-oriented Hadoop distributed file system storage policy in cloud computing | |
CN106844050A (en) | A kind of memory allocation method and device | |
CN108038062B (en) | Memory management method and device of embedded system | |
CN101488919B (en) | Memory address allocation method and apparatus | |
CN101329655A (en) | Memory management method and device | |
CN104317734A (en) | Memory allocation method and device applicable to SLAB | |
CN110276454A (en) | Method and electronic system for the system and control of the machine learning system | |
CN104850505A (en) | Memory management method and system based on chain type stacking | |
CN102521143A (en) | Heap data processing method and device | |
CN102439570A (en) | Memory management method and device aiming at multi-step length non conformance memory access numa framework |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |