Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\memcontrol.c Create Date:2022-07-28 16:14:46
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:mem_cgroup_try_charge_swap - try charging swap space for a page*@page: page being added to swap*@entry: swap entry to charge* Try to charge @page's memcg for the swap space at @entry.* Returns 0 on success, -ENOMEM on failure.

Proto:int mem_cgroup_try_charge_swap(struct page *page, swp_entry_t entry)

Type:int

Parameter:

TypeParameterName
struct page *page
swp_entry_tentry
6930  nr_pages = hpage_nr_pages(page)
6935  If Not cgroup_subsys_on_dfl - fast test on whether a subsys is on default hierarchy*@ss: subsystem in question(memory_cgrp_subsys) || Not Whether the swap controller is active Then Return 0
6938  memcg = mem_cgroup
6941  If Not memcg Then Return 0
6944  If Not val Then
6945  memcg_memory_event(memcg, MEMCG_SWAP_FAIL)
6946  Return 0
6949  memcg = mem_cgroup_id_get_online(memcg)
6951  If Not mem_cgroup_is_root(memcg) && Not page_counter_try_charge - try to hierarchically charge pages*@counter: counter*@nr_pages: number of pages to charge*@fail: points first counter to hit its limit, if any* Returns %true on success, or %false and @fail if the counter or one Then
6953  memcg_memory_event(memcg, MEMCG_SWAP_MAX)
6954  memcg_memory_event(memcg, MEMCG_SWAP_FAIL)
6955  mem_cgroup_id_put(memcg)
6956  Return -ENOMEM
6960  If nr_pages > 1 Then mem_cgroup_id_get_many(memcg, nr_pages - 1)
6962  oldid = swap_cgroup_record(entry, mem_cgroup_id(memcg), nr_pages)
6963  VM_BUG_ON_PAGE(oldid, page)
6964  dx can be of type enum memcg_stat_item or node_stat_item
6966  Return 0