System and method for optimizing non-volatile random access memory usage
An information handling system includes a non-volatile memory (NVRAM) and a processor. The NVRAM stores a plurality of NVRAM variables and a basic input/output system (BIOS) of the information handling system. The BIOS includes system BIOS variable services. The processor executes the system BIOS variable services. While executing the system BIOS variable services, the processor determines whether a holding area of a first NVRAM variable of the NVRAM variables is completely used. In response to the storage being completely used, the processor calculates a new size of the holding area based on metadata of the first NVRAM variable, and creates a new storage area for the first NVRAM variable. The size of a second holding area of the new storage area equals the new size.
1. An information handling system, comprising:
a non-volatile random access memory (NVRAM) to store a plurality of NVRAM variables and to store a basic input/output system (BIOS) of the information handling system, wherein the BIOS includes system BIOS variable services; and
a processor to communicate with the non-volatile memory, the processor to execute the system BIOS variable services, wherein the system BIOS variable services cause the processor to:
determine whether a holding area of a first NVRAM variable of the NVRAM variables is completely used;
in response to the storage being completely used, calculate a new size of the holding area based on metadata of the first NVRAM variable;
creating a new storage area for the first NVRAM variable, wherein a size of a second holding area of the new storage area equals the new size; and
during a garbage collection operation, the processor to:
determine whether a usage of the second holding area satisfies a threshold usage; and
in response to the second holding area satisfying the threshold usage, to reformat data in the second holding area to reduce the usage of the second holding area to a value below the threshold usage, wherein the reformatting of the data in the second holding area includes the processor to:
determine a number of bits in the second holding area set to a first state; and
based on the number of bits in the second holding area set to the first state being an even number of bits, reset all of the bits in the second holding area to a second state.
2. The information handling system of claim 1 , wherein the reformat of the data in the second holding maintains an enable/disable state of the first NVRAM variable.
3. The information handling system of claim 1 , the processor executing the system BIOS variable services further to:
determine whether a garbage collection operation is triggered;
in response to the garbage collection operation being triggered, collect a NVRAM usage map;
create a runtime data record of the NVRAM usage map;
provide the runtime data record of the NVRAM usage map to an operating system of the information handling system; and
send the runtime data record of the NVRAM usage map from the operating system to a cloud storage system.
4. The information handling system of claim 1 , wherein the metadata for the first NVRAM variable includes the size of the holding area, a waste index value, an increment count, and a decrement count.
5. The information handling system of claim 1 , wherein the processor further to execute a machine learning process to calculate the new size of the holding area based on the metadata of the first NVRAM variable.
6. A method, comprising:
storing a plurality of non-volatile random access memory (NVRAM) variables and a basic input/output system (BIOS) in an NVRAM of a first information handling system, wherein the BIOS includes system BIOS variable services;
executing, by a processor, the system BIOS variable services;
determining whether a holding area of a first NVRAM variable of the NVRAM variables is completely used;
in response to the storage being completely used, calculating a new size of the holding area based on metadata of the first NVRAM variable;
creating a new storage area for the first NVRAM variable, wherein a size of a second holding area of the new storage area equals the new size; and
during a garbage collection operation:
determining whether a usage of the second holding area satisfies a threshold usage; and
in response to the second holding area satisfying the threshold usage, reformatting data in the second holding area to reduce the usage of the second holding area to a value below the threshold usage, wherein the reformatting of the data in the second holding area includes:
determining a number of bits in the second holding area set to a first state; and
based on the number of bits in the second holding area set to the first state being an even number of bits, resetting all of the bits in the second holding area to a second state.
7. The method of claim 6 , wherein the reformatting of the data in the second holding maintains an enable/disable state of the first NVRAM variable.
8. The method of claim 6 , further comprising:
determining whether a garbage collection operation is triggered;
in response to the garbage collection operation being triggered, collecting a NVRAM usage map;
creating a runtime data record of the NVRAM usage map;
providing the runtime data record of the NVRAM usage map to an operating system of the information handling system; and
sending the runtime data record of the NVRAM usage map from the operating system to a cloud storage system.
9. The method of claim 8 , further comprising:
receiving a user log on at a second information handling system, wherein the user is associated with the first information handling system;
sending, from the cloud storage system, the NVRAM usage map to an operating system of the second information handling system;
determining whether the NVRAM usage map is newer than a second NVRAM usage map currently stored in a second NVRAM of the second information handling system;
in response to the NVRAM usage map being newer than the second NVRAM usage map, sending the NVRAM usage map to a second BIOS of the second information handling system; and
applying, by the BIOS, the NVRAM usage map to second NVRAM of the second information handling system.
10. The method of claim 6 , wherein the metadata for the first NVRAM variable includes the size of the holding area, a waste index value, an increment count, and a decrement count.
11. The method of claim 6 , further comprising:
executing a machine learning process to calculate the new size of the holding area based on the metadata of the first NVRAM variable.
12. A non-transitory computer-readable medium including code that when executed by a processor causes the processor to perform a method, the method comprising:
storing a plurality of non-volatile random access memory (NVRAM) variables and a basic input/output system (BIOS) in an NVRAM of a first information handling system, wherein the BIOS includes system BIOS variable services;
executing the system BIOS variable services;
determining whether a holding area of a first NVRAM variable of the NVRAM variables is completely used;
in response to the storage being completely used, calculating a new size of the holding area based on metadata of the first NVRAM variable; and
creating a new storage area for the first NVRAM variable, wherein a size of a second holding area of the new storage area equals the new size;
determining whether a garbage collection operation is triggered;
in response to the garbage collection operation being triggered, collecting a NVRAM usage map;
creating a runtime data record of the NVRAM usage map;
providing the runtime data record of the NVRAM usage map to an operating system of the information handling system; and
sending the runtime data record of the NVRAM usage map from the operating system to a cloud storage system.
13. The non-transitory computer-readable medium of claim 12 , during a garbage collection operation, the method further comprises:
determining whether a usage of the second holding area satisfies a threshold usage; and
in response to the second holding area satisfying the threshold usage, reformatting data in the second holding area to reduce the usage of the second holding area to a value below the threshold usage.
14. The non-transitory computer-readable medium of claim 13 , wherein the reformatting of the data in the second holding maintains an enable/disable state of the first NVRAM variable.
15. The non-transitory computer-readable medium of claim 12 , the method further comprising:
receiving a user log on at a second information handling system, wherein the user is associated with the first information handling system;
sending, from the cloud storage system, the NVRAM usage map to an operating system of the second information handling system;
determining whether the NVRAM usage map is newer than a second NVRAM usage map currently stored in a second NVRAM of the second information handling system;
in response to the NVRAM usage map being newer than the second NVRAM usage map, sending the NVRAM usage map to a second BIOS of the second information handling system; and
applying, by the BIOS, the NVRAM usage map to second NVRAM of the second information handling system.
16. The non-transitory computer-readable medium of claim 12 , wherein the metadata for the first NVRAM variable includes the size of the holding area, a waste index value, an increment count, and a decrement count.
17. The non-transitory computer-readable medium of claim 12 , the method further comprising:
executing a machine learning process to calculate the new size of the holding area based on the metadata of the first NVRAM variable.