IP Library › Granted Patent US 10,417,062
Granted Patent B2
US 10,417,062 · App. 15/280,122 · Granted Sep 17, 2019

Method and apparatus of unloading out of memory processing flow to user space

Inventors: Linsi Yuan (Beijing, CN); Baisheng Wang (Beijing, CN); Dong Sun (Beijing, CN); Zhiyong Li (Beijing, CN)
Assignee: Beijing Baidu Netcom Science and Technology Co., Ltd.
G06F9/542G06F3/0613G06F3/0647G06F3/0659G06F3/0683G06F9/485G06F9/545
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 10,417,062
App. No.
15/280,122
Granted
Sep 17, 2019
Kind
B2
Abstract

The present application discloses a method and apparatus of unloading an out of memory (OOM) processing flow to a user space. A specific implementation of the method includes: writing related information of an OOM event into a memory page shared by a user space and a kernel space when a process triggers the OOM event, the related information comprising: an identification of the process and a path of a memory resource control sub-system where the process exists; acquiring, by an OOM service process of the user space, the related information of the OOM event through the memory page; and processing, by the OOM service process of the user space, the OOM event using the related information of the OOM event. The implementation implements unloading of an OOM processing in a kernel state to a user state for execution, and the whole OOM processing process is handed over to a user state process for implementation, which reduces the complexity of execution of the OOM processing, and is conducive to adjustment of OOM processing strategies and upgrade and replacement of services.

Claims (43)

1. A method of unloading an out of memory (OOM) processing flow to a user space, comprising:

writing related information of an OOM event into a memory page shared by a user space and a kernel space when a process triggers the OOM event, the related information comprising: an identification of the process and a path of a memory resource control sub-system where the process exists;

switching the process triggering the OOM event from an operating state to a sleep state, and suspending the process triggering the OOM event to a waiting queue;

suspending creation of a new process in a group the OOM event occurs or migration of processes into the group;

notifying an OOM service process of the user space;

adding flags to the OOM service process of the user space to enable the OOM service process of the user space to use a memory under a water line reserved by a system for a kernel, and ensure that the OOM service process of the user space does not respond to a process termination signal sent by the user space;

acquiring, by the OOM service process of the user space, the related information of the OOM event through the memory page; and

processing, by the OOM service process of the user space, the OOM event using the related information of the OOM event.

2. The method according to claim 1 , further comprising:

awakening the process triggering the OOM in the waiting queue after completing the processing of the OOM event, and reattempting to apply for memory.

3. The method according to claim 1 , wherein the processing, by the OOM service process of the user space, the OOM event using the related information of the OOM event comprises:

scoring, by the OOM service process of the user space, terminatable processes based on memory occupation conditions; and

sending, by the OOM service process of the user space, a second process termination signal to the process having a highest score.

4. The method according to claim 1 , wherein the processing, by the OOM service process of the user space, the OOM event using the related information of the OOM event comprises:

sending, by the OOM service process of the user space, a notification of completion of the processing of the OOM event to the kernel space.

5. The method according to claim 1 , further comprising:

monitoring the OOM service process of the user space, and spontaneously reporting an exit event before the OOM service process of the user space exits.

6. An apparatus of unloading an out of memory (OOM) processing flow to a user space, comprising:

at least one processor; and a memory storing instructions, the instructions when executed by the at least one processor, cause the at least one processor to perform operations, the operations comprising:

writing related information of an OOM event into a storage module shared by a user space and a kernel space when a process triggers the OOM event, the related information comprising: an identification of the process and a path of a memory resource control sub-system where the process exists;

switching the process triggering the OOM event from an operating state to a sleep state, and suspending the process triggering the OOM event to a waiting queue;

suspending creation of a new process in a group the OOM event occurs or migration of processes into the group;

notifying an OOM service process of the user space;

adding flags to the OOM service process of the user space to enable the OOM service process of the user space to use a memory under a water line reserved by a system for a kernel, and ensure that the OOM service process of the user space does not respond to a process termination signal sent by the user space;

acquiring the related information of the OOM event through the storage module; and

processing the OOM event using the related information of the OOM event.

7. The apparatus according to claim 6 , wherein the operations further comprise:

awakening the process triggering the OOM in the waiting queue after completing the processing of the OOM event, and reattempt to apply for memory.

8. The apparatus according to claim 6 , wherein the processing, by the OOM service process of the user space, the OOM event using the related information of the OOM event comprises:

scoring, by the OOM service process of the user space, terminatable processes that based on memory occupation conditions; and

sending, by the OOM service process of the user space, a second process termination signal to the process having a highest score.

9. The apparatus according to claim 6 , wherein the processing, by the OOM service process of the user space, the OOM event using the related information of the OOM event comprises:

sending, by the OOM service process of the user space, a notification of completion of the processing of the OOM event to the OOM kernel module.

10. The apparatus according to claim 6 , further comprising:

monitoring the OOM service process of the user space, and spontaneously reporting an exit event to the OOM kernel module before the OOM service process of the user space exits.

11. A non-transitory storage medium storing one or more programs, the one or more programs when executed by an apparatus, causing the apparatus to perform a method of unloading an out of memory (OOM) processing flow to a user space, the method comprising:

writing related information of an OOM event into a memory page shared by a user space and a kernel space when a process triggers the OOM event, the related information comprising: an identification of the process and a path of a memory resource control sub-system where the process exists;

switching the process triggering the OOM event from an operating state to a sleep state, and suspending the process triggering the OOM event to a waiting queue;

suspending creation of a new process in a group the OOM event occurs or migration of processes into the group;

notifying an OOM service process of the user space;

adding flags to the OOM service process of the user space to enable the OOM service process of the user space to use a memory under a water line reserved by a system for a kernel, and ensure that the OOM service process of the user space does not respond to a process termination signal sent by the user space;

acquiring, by the OOM service process of the user space, the related information of the OOM event through the memory page; and

processing, by the OOM service process of the user space, the OOM event using the related information of the OOM event.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jul 29, 2019
From: YUAN, LINSI; WANG, BAISHENG; SUN, DONG; LI, ZHIYONG
To: BEIJING BAIDU NETCOM SCIENCE AND TECHNOLOGY CO.
Reel/Frame 049893/0647 →
Priority Claims (1)
CN 2016 1 0320045 · May 13, 2016 · national
Continuity (1)
Related Publication 20170329655A1 · Nov 16, 2017