Background memory manager that determines if data structures fits in memory with memory state transactions map

Information

  • Patent Grant
  • 7502876
  • Patent Number
    7,502,876
  • Date Filed
    Friday, June 23, 2000
    24 years ago
  • Date Issued
    Tuesday, March 10, 2009
    15 years ago
Abstract
A background memory manager (BMM) for managing a memory in a data processing system has circuitry for transferring data to and from an outside device and to and from a memory, a memory state map associated with the memory, and a communication link to a processor. The BMM manages the memory, determining if each data structure fits into the memory, deciding exactly where to place the data structure in memory, performing all data transfers between the outside device and the memory, and maintaining the memory state map according to memory transactions made, and informing the processor of new data and its location. In preferred embodiments the BMM, in the process of storing data structures into the memory, provides an identifier for each structure to the processor. The system is particularly applicable to Internet packet processing in packet routers.
Description
FIELD OF THE INVENTION

The present invention is in the area of integrated circuit microprocessors, and pertains in particular to memory management, and the use of microprocessor resources in such management.


BACKGROUND OF THE INVENTION

Microprocessors, as is well-known in the art, are integrated circuit (IC) devices that are enabled to execute code sequences which may be generalized as software. In the execution most microprocessors are capable of both logic and arithmetic operations, and typically modern microprocessors have on-chip resources (functional units) for such processing.


Microprocessors in their execution of software strings typically operate on data that is stored in memory. This data needs to be brought into the memory before the processing is done, and sometimes needs to be sent out to a device that needs it after its processing.


There are in the state-of-the-art two well-known mechanisms to bring data into the memory and send it out to a device when necessary. One mechanism is loading and storing the data through a sequence of Input/Output (I/O) instructions. The other is through a direct-memory access device (DMA).


In the case of a sequence of I/O instructions, the processor spends significant resources in explicitly moving data in and out of the memory. In the case of a DMA system, the processor programs an external hardware circuitry to perform the data transferring. The DMA circuitry performs all of the required memory accesses to perform the data transfer to and from the memory, and sends an acknowledgement to the processor when the transfer is completed.


In both cases of memory management in the art the processor has to explicitly perform the management of the memory, that is, to decide whether the desired data structure fits into the available memory space or does not, and where in the memory to store the data. To make such decisions the processor needs to keep track of the regions of memory wherein useful data is stored, and regions that are free (available for data storage). Once that data is processed, and sent out to another device or location, the region of memory formerly associated with the data is free to be used again by new data to be brought into memory. If a data structure fits into the available memory, the processor needs to decide where the data structure will be stored. Also, depending on the requirements of the processing, the data structure can be stored either consecutively, in which case the data structure must occupy one of the empty regions of memory; or non-consecutively, wherein the data structure may be partitioned into pieces, and the pieces are then stored into two or more empty regions of memory.


An advantage of consecutively storing a data structure into memory is that the accessing of this data becomes easier, since only a pointer to the beginning of the data is needed to access all the data.


When data is not consecutively stored into the memory, access to the data becomes more difficult because the processor needs to determine the explicit locations of the specific bytes it needs. This can be done either in software (i.e. the processor will spend its resources to do this task) or in hardware (using a special circuitry). A drawback of consecutively storing the data into memory is that memory fragmentation occurs. Memory fragmentation happens when the available chunks of memory are smaller than the data structure that needs to be stored, but the addition of the space of the available chunks is larger than the space needed by the data structure. Thus, even though enough space exists in the memory to store the data structure, it cannot be consecutively stored. This drawback does not exist if the data structure is allowed to be non-consecutively stored.


Still, a smart mechanism is needed to generate the lowest number of small regions, since the larger the number of small regions that are used by a data structure, the more complex the access to the data becomes (more specific regions need to be tracked) regardless of whether the access is managed in software or hardware as explained above.


What is clearly needed is system for background management of memory in systems where large amounts of data must be moved to and from a memory for processing.


SUMMARY OF THE INVENTION

In a preferred embodiment of the present invention a background memory manager (BMM) for managing a memory in a data processing system is provided, the BMM comprising circuitry for transferring data to and from an outside device and to and from a memory, a memory state map associated with the memory, and a communication link to a processor. The BMM manages the memory, performing all data transfers between the outside device and the memory, and maintains the memory state map according to memory transactions made.


In preferred embodiments the BMM, after storing a data structure into the memory, provides a data identifier for the structure on the link to the processor. Also in preferred embodiments, the BMM, in making memory transactions, updates the memory state map to the new memory state, keeping track of regions occupied by valid data and regions not occupied by valid data.


In some embodiments the BMM, in response to a signal on the processor link that the processor is finished with certain identified data in the memory, copies the data from the memory to another device, and updates the memory state map to indicate the region of the data copied. There may further be an interrupt handler allowing a remote data source to interrupt the BMM when data is available to be transferred to the memory. The BMM in preferred embodiments is particularly suited for handling data packets in a packet processing router.


In another aspect of the invention a data processing system is provided, comprising a processor, a memory coupled to the processor, and a background memory manager coupled to the memory and the processor, the background memory manager including circuitry for transferring data to and from an outside device and to and from the memory, and a memory state map associated with the memory. The BMM manages the memory, performing all data transfers between the outside device and the memory, and maintains the memory state map according to memory transactions made.


In preferred embodiments of the system the BMM, after storing a data structure into the memory, provides a data identifier for the structure to the processor. Also in preferred embodiments the BMM, in making memory transactions, updates the memory state map to the new memory state, keeping track of regions occupied by valid data and regions not occupied by valid data.


In some embodiments of the system the BMM, in response to a signal from the processor that the processor is finished with certain identified data in the memory, copies the data from the memory to another device, and updates the memory state map to indicate the region of the data copied. In some embodiments there is an interrupt handler allowing a remote data source to interrupt the BMM when data is available to be transferred to the memory. The data processing system is particularly suited to processing data packets in Internet packet processors.


In yet another aspect of the invention a network packet router is provided, comprising an input/output (I/O) device for receiving and sending packets on the network, a processor, a memory coupled to the processor, and a background memory manager coupled to the memory and the processor, the background memory manager including circuitry for transferring packets to and from the I/O device and to and from the memory, and a memory state map associated with the memory. The BMM manages the memory, performing all packet transfers between the I/O device and the memory, and maintains the memory state map according to memory transactions made.


In a preferred embodiment the BMM, after storing a packet into the memory, provides a data identifier for the packet to the processor. Also in a preferred embodiment the BMM, in making memory transactions, updates the memory state map to the new memory state, keeping track of regions occupied by valid packets and regions not occupied by valid packets.


In some embodiments the BMM, in response to a signal that the processor is finished with a packet in the memory, copies the packet from the memory to the I/O device, and updates the memory state map to indicate the region of the packet copied. There may also be an interrupt handler allowing the I/O device to interrupt the BMM when packets are available to be transferred to the memory.


In still another aspect of the present invention a method for managing a memory in a data processing system is provided, comprising the steps of (a) transferring data to and from an outside device and to and from the memory by circuitry in a background memory manager (BMM); (b) updating a memory state map associated with the memory in the BMM each time a memory transaction is made; and (c) notifying a processor with memory state data each time a change is made.


In preferred embodiments of the method, in step (c), the BMM, after storing a data structure into the memory, provides a data identifier for the structure on the link to the processor. Also in preferred embodiments the BMM, in step (b), in making memory transactions, updates the memory state map to the new memory state, keeping track of regions occupied by valid data and regions not occupied by valid data.


In some embodiments, in step (a), the BMM, in response to a signal that the processor is finished with certain identified data in the memory, copies the data from the memory to another device, and updates the memory state map to indicate the region of the data copied. There may further be a step for interrupting the BMM by the outside device when data is available to be transferred to the memory. The method is particularly well suited for processing data packets in a packet router, such as in the Internet.


In embodiments of the invention, taught in enabling detail below, for the first time an apparatus and methods are provided for complete background memory management, freeing processor power in systems like Internet packet routers, to accomplish more processing, by not being required to do memory management.





BRIEF DESCRIPTION OF THE DRAWING FIGURES


FIG. 1 is a simplified diagram of memory management by direct I/O processing in the prior art.



FIG. 2 is a simplified diagram of memory management by direct memory access in the prior art.



FIG. 3 is a diagram of memory management by a Background Memory Manager in a preferred embodiment of the present invention.





DESCRIPTION OF THE PREFERRED EMBODIMENTS


FIG. 1 is a simplified diagram of memory management in a system 104 comprising a processor 100 and a memory 102 in communication with a device 106. In this example it is necessary to bring data from device 106 into memory 102 for processing, and sometimes to transmit processed data from memory 102 to device 106, if necessary. Management in this prior art example is by processor 100, which sends I/O commands to and receives responses and/or interrupts from device 106 via path 108 to manage movement of data between device 106 and memory 102 by path 110. The processor has to determine whether a data structure can fit into available space in memory, and has to decide where in the memory to store incoming data structures. Processor 100 has to fully map and track memory blocks into and out of memory 102, and retrieves data for processing and stores results, when necessary, back to memory 102 via path 114. This memory management by I/O commands is very slow and cumbersome and uses processor resources quite liberally.



FIG. 2 is a simplified diagram of a processor system 200 in the prior art comprising a processor 100, a memory 102 and a direct memory access (DMA) device 202. This is the second of two systems by which data, in the conventional art, is brought into a system, processed, and sent out again, the first of which is by I/O operations as described just above. System 200 comprises a DMA device 202 which has built-in intelligence, which may be programmed by processor 100, for managing data transfers to and from memory 102. DMA device 202 is capable of compatible communication with external device 106, and of moving blocks of data between device 102 and 106, bi-directionally. The actual data transfers are handled by DMA device 202 transparently to processor 100, but processor 100 must still perform the memory mapping tasks, to know which regions of memory are occupied with data that must not be corrupted, and which regions are free to be occupied (overwritten) by new data.


In the system of FIG. 2 DMA processor 100 programs DMA device 202. This control communication takes place over path 204. DMA device 202 retrieves and transmits data to and from device 106 by path 208, and handles data transfers between memory 102 and processor 100 over paths 204 and 206.


In these descriptions of prior art the skilled artisan will recognize that paths 204, 206 and 208 are virtual representations, and that actual data transmission may be by various physical means known in the art, such as by parallel and serial bus structures operated by bus managers and the like, the bus structures interconnecting the elements and devices shown.



FIG. 3 is a schematic diagram of a system 300 including a Background Memory Manager (BMM) 302 according to an embodiment of the present invention. BMM 302 a hardware mechanism enabled to manage the memory in the background, i.e. with no intervention of the processor to decide where the data structure will be stored in the memory. Thus, the processor can utilize its resources for tasks other than to manage the memory.


The present invention in several embodiments is applicable in a general way to many computing process and apparatus. For example, in a preferred embodiment the invention is applicable and advantageous in the processing of data packets at network nodes, such as in routers in packet routers in the Internet. The packet processing example is used below as a specific example of practice of the present invention to specifically describe apparatus, connectivity and functionality.


In the embodiment of a packet router, device 106 represents input/output apparatus and temporary storage of packets received from and transmitted on a network over path 308. The network in one preferred embodiment is the well-known Internet network. Packets received from the Internet in this example are retrieved from device 106 by BMM 302, which also determines whether packets can fit into available regions in memory and exactly where to store each packet, and stores the packets in memory 102, where they are available to processor 100 for processing. Processor 100 places results of processing back in memory 102, where the processed packets are retrieved, if necessary, by BMM on path 312 and sent back out through device 106.


In the embodiment of FIG. 3 BMM 302 comprises a DMA 202 and also a memory state map 304. BMM 302 also comprises an interrupt handler in a preferred embodiment, and device 106 interrupts BMM 302 when a packet is received. When a packet is received, using DMA 202 and state map 304, the BMM performs the following tasks:


1. Decides whether a data structure fits into the memory. Whether the structure fits into memory, then, is a function of the size of the data packet and the present state of map 304, which indicates those regions of memory 102 that are available for new data to be stored.


2. If the incoming packet in step 1 above fits into memory, the BMM determines an optimal storage position. It was described above that there are advantages in sequential storage. Because of this, the BMM in a preferred embodiment stores packets into memory 102 in a manner to create a small number of large available regions, rather than a larger number of smaller available regions.


3. BMM 302 notifies processor 100 on path 310 when enough of the packet is stored, so that the processor can begin to perform the desired processing. An identifier for this structure is created and provided to the processor. The identifier communicates at a minimum the starting address of the packet in memory, and in some cases includes additional information.


4. BMM updates map 304 for all changes in the topology of the memory. This updating can be done in any of several ways, such as periodically, or every time a unit in memory is changed.


5. When processing is complete on a packet the BMM has stored in memory 102, the processor notifies BMM 302, which then transfers the processed data back to device 106. This is for the particular example of a packet processing task. In some other embodiments data may be read out of memory 102 by MM 302 and sent to different devices, or even discarded. In notifying the BMM of processed data, the processor used the data structure identifier previously sent by the BMM upon storage of the data in memory 102.


6. The BMM updates map 304 again, and every time it causes a change in the state of memory 102. Specifically the BMM de-allocates the region or regions of memory previously allocated to the data structure and sets them as available for storage of other data structures, in this case packets.


It will be apparent to the skilled artisan that there may be many alterations in the embodiments described above without departing from the spirit and scope of the present invention. For example, a specific case of operations in a data packet router was illustrated. This is a single instance of a system wherein the invention may provide significant advantages. There are many other systems and processes that will benefit as well. Further, there are a number of ways BMM 302 may be implemented to perform the functionality described above, and there are many systems incorporating many different kinds of processors that might benefit. The present inventors are particularly interested in a system wherein a dynamic multi-streaming processor performs the functions of processor 100. For these reasons the invention should be limited only by the scope of the claims as listed below.

Claims
  • 1. A background memory manager (BMM) for managing a memory in a data processing system, the BMM comprising: circuitry for transfer a data structure to and from an outside device and to and from a memory; anda communication link;management logic coupled to a processor by the communication link and configured to determine if the data structure fits into the memory, to decide where, in a plurality of regions in the memory, to store the data structure, to perform data transfers between the outside device and the memory, to maintain a memory state map according to memory transactions made, and to inform the processor of new data and its location.
  • 2. The BMM of claim 1, wherein the management logic is further configured to provide, for the data structure and when the data structure is stored, a data identifier on the communication link.
  • 3. The BMM of claim 2, wherein the management logic is further configured to update, in response to the memory transactions, the memory state map to a new memory state to keep track of regions occupied by valid data and regions unoccupied by valid data.
  • 4. The BMM of claim 2, wherein the management logic is further configured to copy, in response to a signal on the communication link that the processor is finished with identified data in the memory, the identified data from the memory to another device and to update the memory state map to indicate a new memory state for a region of the identified data data.
  • 5. The BMM of claim 1, further comprising an interrupt handler configured to allow a remote data source to interrupt the BMM when data is available to be transferred to the memory.
  • 6. The BMM of claim 1, wherein data handled by the BMM constitutes network data packets.
  • 7. A data processing system, comprising: a processor;a memory coupled to the processor; anda background memory manager (BMM) coupled to the memory and the processor, the BMM including circuitry to transfer a data structure to and from an outside device and to and from the memory and including management logic configured to determine if the data structure fits into the memory, to decide where, in a plurality of regions in the memory, to store the data structure, to perform data transfers between the outside device and the memory, to maintain a memory state map according to memory transactions made, and to inform the processor of new data and its location.
  • 8. The data processing system of claim 7, wherein the management logic is further configured to provide, for the data structure and when the data structure is stored, a data identifier to the processor.
  • 9. The data processing system of claim 8, wherein the management logic is further configured to update, in response to the memory transactions, the memory state map to a new memory state to keep track of regions occupied by valid data and regions unoccupied by valid data.
  • 10. The data processing system of claim 8 wherein the management logic is further configured to copy, in response to a signal from the processor that the processor is finished with identified data in the memory, the identified data from the memory to another device and to update the memory state map to indicate a new memory state for a region of the identified data data.
  • 11. The data processing system of claim 7, further comprising an interrupt handler configured to allow a remote data source to interrupt the BMM when data is available to be transferred to the memory.
  • 12. The data processing system of claim 7, wherein data handled by the BMM constitutes network data packets.
  • 13. A network packet router, comprising: an input/output (I/O) device configured to receive and to send a packet on the network;a processor;a memory coupled to the processor; anda background memory manager (BMM) coupled to the memory and the processor, the BMM including circuitry configured to transfer the packet to and from the I/O device and to and from the memory and including management logic configured to determine if the packet fits into the memory, to decide where, in a plurality of regions in the memory, to store the packet, to perform data transfers between the I/O device and the memory, to maintain a memory state map according to memory transactions made, and to inform the processor of new data and its location.
  • 14. The data router of claim 13 wherein the management logic is further configured to provide, for the packet and when the packet is stored, a data identifier to the processor.
  • 15. The data router of claim 14, wherein the management logic is further configured to update, in response to the memory transactions, the memory state map to a new memory state to keep track of regions occupied by valid packets and regions unoccupied by valid packets.
  • 16. The data router of claim 14, wherein the management logic is further configured to copy, in response to a signal that the processor is finished with a first packet in the memory, the first packet from the memory to the I/O device and to update the memory state map to indicate a new memory state for a region of the first packet packet.
  • 17. The data router of claim 13, further comprising an interrupt handler configured to allow the I/O device to interrupt the BMM when packets are available to be transferred to the memory.
  • 18. The data router of claim 13, wherein the BMM is further characterized by being configured to notify the processor when enough of the packet is stored for the processor to being to perform desired processing.
  • 19. A method for managing a memory in a data processing system having a processor, the method comprising: (a) transferring a data structure to and from an outside device and to and from the memory by circuitry in a background memory manager (BMM);(b) determining by the BMM if the data structure from the outside device will fit into available space in the memory;(c) deciding by the BMM exactly where, in a plurality of regions in the memory, to store the data structure; and(d) updating a memory state map in the BMM when a memory transaction is made.
  • 20. The method of claim 19, further comprising providing, for the data structure and when the data structure is stored, a data identifier on a link to the processor.
  • 21. The method of claim 20, further comprising keeping track of regions occupied by valid data and regions unoccupied by valid data.
  • 22. The method of claim 20, further comprising: copying, in response to a signal that the processor is finished with identified data in the memory, the identified data from the memory to another device; andupdating the memory state map to indicate a new memory state for a region of the identified data.
  • 23. The method of claim 19, further comprising interrupting the BMM by the outside device when data is available to be transferred to the memory.
  • 24. The method of claim 19, wherein data handled by the BMM constitutes network data packets.
  • 25. The method of claim 24, wherein the network data packets are conveyed on the Internet.
US Referenced Citations (110)
Number Name Date Kind
4200927 Huges et al. Apr 1980 A
4707784 Ryan et al. Nov 1987 A
4942518 Weatherford et al. Jul 1990 A
5023776 Gregor Jun 1991 A
5121383 Golestani Jun 1992 A
5291481 Doshi et al. Mar 1994 A
5408464 Jurkevich Apr 1995 A
5465331 Yang et al. Nov 1995 A
5471598 Quattromani et al. Nov 1995 A
5521916 Choudhury et al. May 1996 A
5559970 Sharma Sep 1996 A
5619497 Gallagher et al. Apr 1997 A
5634015 Chang et al. May 1997 A
5659797 Zandveld et al. Aug 1997 A
5675790 Walls Oct 1997 A
5684797 Aznar et al. Nov 1997 A
5708814 Short et al. Jan 1998 A
5724565 Dubey et al. Mar 1998 A
5737525 Picazo et al. Apr 1998 A
5784649 Begur et al. Jul 1998 A
5784699 McMahon et al. Jul 1998 A
5796966 Simcoe et al. Aug 1998 A
5809321 Hansen et al. Sep 1998 A
5812810 Sager Sep 1998 A
5835491 Davis et al. Nov 1998 A
5892966 Petrick et al. Apr 1999 A
5918050 Rosenthal et al. Jun 1999 A
5951679 Anderson et al. Sep 1999 A
5978570 Hillis Nov 1999 A
5978893 Bakshi et al. Nov 1999 A
5987578 Butcher Nov 1999 A
6009516 Steiss et al. Dec 1999 A
6016308 Crayford et al. Jan 2000 A
6023738 Priem et al. Feb 2000 A
6047122 Spiller Apr 2000 A
6058267 Kanai et al. May 2000 A
6067608 Perry May 2000 A
6070202 Minkoff et al. May 2000 A
6073251 Jewett et al. Jun 2000 A
6088745 Bertagna et al. Jul 2000 A
6131163 Wiegel Oct 2000 A
6151644 Wu Nov 2000 A
6157955 Narad et al. Dec 2000 A
6169745 Liu et al. Jan 2001 B1
6173327 De Borst et al. Jan 2001 B1
6195680 Goldszmidt et al. Feb 2001 B1
6219339 Doshi et al. Apr 2001 B1
6219783 Zahir et al. Apr 2001 B1
6223274 Catthoor et al. Apr 2001 B1
6226680 Boucher et al. May 2001 B1
6247040 Born et al. Jun 2001 B1
6247105 Goldstein et al. Jun 2001 B1
6249801 Zisapel et al. Jun 2001 B1
6249846 Van Doren et al. Jun 2001 B1
6253313 Morrison et al. Jun 2001 B1
6263452 Jewett et al. Jul 2001 B1
6377972 Guo et al. Apr 2002 B1
6381242 Maher, III et al. Apr 2002 B1
6389468 Muller et al. May 2002 B1
6393028 Leung May 2002 B1
6438135 Tzeng Aug 2002 B1
6453360 Muller et al. Sep 2002 B1
6460105 Jones et al. Oct 2002 B1
6483804 Muller et al. Nov 2002 B1
6502213 Bowman-Amuah Dec 2002 B1
6523109 Meier Feb 2003 B1
6529515 Raz et al. Mar 2003 B1
6535905 Kalafatis et al. Mar 2003 B1
6549996 Manry et al. Apr 2003 B1
6581102 Amini et al. Jun 2003 B1
6614796 Black et al. Sep 2003 B1
6618820 Krum Sep 2003 B1
6625808 Tarditi Sep 2003 B1
6640248 Jorgensen Oct 2003 B1
6650640 Muller et al. Nov 2003 B1
6738371 Ayres May 2004 B1
6738378 Tuck, III et al. May 2004 B2
6792509 Rodriguez Sep 2004 B2
6813268 Kalkunte et al. Nov 2004 B1
6820087 Langendorf et al. Nov 2004 B1
6965982 Nemawarkar Nov 2005 B2
7032226 Nemirovsky et al. Apr 2006 B1
7065096 Musoll et al. Jun 2006 B2
20010004755 Levy et al. Jun 2001 A1
20010005253 Komatsu Jun 2001 A1
20010024456 Zaun et al. Sep 2001 A1
20010043610 Nemirovsky et al. Nov 2001 A1
20010052053 Nemirovsky et al. Dec 2001 A1
20020016883 Musoll et al. Feb 2002 A1
20020049964 Takayama et al. Apr 2002 A1
20020054603 Mussoll et al. May 2002 A1
20020071393 Musoll Jun 2002 A1
20020083173 Musoll et al. Jun 2002 A1
20020124262 Basso et al. Sep 2002 A1
20040015598 Jin-Fun Jan 2004 A1
20040148382 Narad et al. Jul 2004 A1
20040172471 Porter Sep 2004 A1
20040172504 Balazich et al. Sep 2004 A1
20040213251 Tran et al. Oct 2004 A1
20050061401 Tokoro et al . Mar 2005 A1
20050066028 Illikkai et al. Mar 2005 A1
20060036705 Musoll et al. Feb 2006 A1
20060090039 Jain et al. Apr 2006 A1
20060153197 Nemirovsky et al. Jul 2006 A1
20060159104 Nemirovsky et al. Jul 2006 A1
20060215670 Sampath et al. Sep 2006 A1
20060215679 Musoll et al. Sep 2006 A1
20060225080 Nemirovsky et al. Oct 2006 A1
20070008989 Joglekar Jan 2007 A1
20070074014 Musoll et al. Mar 2007 A1
Foreign Referenced Citations (1)
Number Date Country
WO 0305645 Jun 2002 WO