本文转载至:http://lists.metaprl.org/pipermail/cs134-labs/2002-October/000025.html

The short (or kinda long) answer is this:GFP_ATOMIC means roughly "make the allocation operation atomic".  This
means that the kernel will try to find the memory using a pile of free
memory set aside for urgent allocation.  If that pile doesn't have
enough free pages, the operation will fail.  This flag is useful for
allocation within interrupt handlers.GFP_KERNEL will try a little harder to find memory.  There's a
possibility that the call to kmalloc() will sleep while the kernel is
trying to find memory (thus making it unsuitable for interrupt
handlers).  It's much more rare for an allocation with GFP_KERNEL to
fail than with GFP_ATOMIC.In all cases, kmalloc() should only be used allocating small amounts of
memory (a few kb).  vmalloc() is better for larger amounts.Also note that in lab 1 and lab 2, it would have been arguably better to
use GFP_KERNEL instead of GFP_ATOMIC.  GFP_ATOMIC should be saved for
those instances in which a sleep would be totally unacceptable.This is a fuzzy issue though...there's no absolute right or wrong
answer.

GFP_ATOMIC or GFP_KERNEL 区别相关推荐

  1. Linux 内核中用 GFP_ATOMIC 申请内存究竟意味着什么?

    作者 | 宋宝华  责编 | 张文 头图 | CSDN 下载自东方 IC 来源 | Linux阅码场(ID:LinuxDev) 本文目的:本文补充校正一些 Linux 内核开发者关于 GFP_ATOM ...

  2. 宋宝华:Linux内核中用GFP_ATOMIC申请内存究竟意味着什么?

    本文目的 本文补充校正一些Linux内核开发者关于GFP_ATOMIC的认知不完整的地方,阐述GFP_ATOMIC与free内存watermark的关系,并明确什么时候应该用GFP_ATOMIC申请内 ...

  3. af_netlink_2、netlink简介

    Netlink 是一种特殊的 socket,它是 Linux 所特有的,类似于 BSD 中的AF_ROUTE 但又远比它的功能强大,目前在最新的 Linux 内核(2.6.14)中使用netlink ...

  4. Linux用户态与内核态通信的几种方式(待完善)

    文章目录 1. 内核启动参数 2.模块参数与sysfs 3.sysctl 4.系统调用 5.netlink 6. procfs(/proc) 7.seq_file 8.debugfs 9.relayf ...

  5. kernel:driver_learn_summary

    Sysfs以及设备模型 Sysfs被加载在 /sys/目录下,它的子目录包括 1)Block:在系统中发现的每个块设备在该目录下对应一个子目录.每个子目录中又包含一些属性文件,它们描述了这个块设备的各 ...

  6. 《Linux内核设计与实现》读书笔记

    文章目录 第1章 Linux内核简介 1.3操作系统和内核简介 单内核和微内核 1.5 Linux内核版本 第2章 从内核出发 2.2 内核源码树 2.4 内核开发的特点 第3章 进程管理 3.1 进 ...

  7. Memory Management [LKD 12]

    kernel中和user space存在很大不同,从user space角度看,分配/释放内存易如反掌,即便失败了也容易处理,kernel里面不一样.比如有些kernel code不允许sleep,或 ...

  8. Linux 内核设计与实现

    Linux 内核系列文章 Linux 内核设计与实现 深入理解 Linux 内核 Linux 设备驱动程序 Linux设备驱动开发详解 文章目录 Linux 内核系列文章 一.前言 二.进程管理 1. ...

  9. linux 内核与用户空间通信之netlink使用方法

    Linux中的进程间通信机制源自于Unix平台上的进程通信机制.Unix的两大分支AT&T Unix和BSD Unix在进程通信实现机制上的各有所不同,前者形成了运行在单个计算机上的Syste ...

最新文章

  1. vCenter Server Appliance 6.5 中重置丢失或忘记的 root 密码
  2. 解决eclipse编译的几种方法
  3. 重磅 | 2017年全球最聪明公司排行榜TOP50,哪9家中国公司上榜?
  4. java7新特性之Try-with-resources statement
  5. windows环境搭建ios+xcode
  6. win10下linux子系统6,Windows10下安装Linux子系统2020年7月最新版
  7. Altium designer—STM32F103ZET6最小系统PCB图
  8. 2、垃圾回收算法(标记清除算法、复制算法、标记整理算法和分代收集算法),各种垃圾收集器讲解(学习笔记)
  9. javascript-字典形态对象与数组形态对象
  10. RECOLL检索软件测试工资,Recoll桌面全文搜索工具
  11. matplotlib在图像上方添加文字、标签
  12. Linux启动过程综述(转)
  13. Java主线程等待所有子线程执行完毕再执行解决办法集
  14. CS:APP3e 深入理解计算机系统_3e Datalab实验
  15. 游戏框架(框架入门篇)
  16. python中国大学慕课平台_乐学Python,中国大学MOOC(慕课)答案公众号搜题
  17. SVG格式文件插入Word/WPS,三种简单快捷的方法,实现图片高清无损
  18. AWVS安装(未来即将到来)
  19. VMware Workstation导出的ovf格式虚拟机 不能用VirtualBox导入
  20. 元胞自动机对传染病模型的模拟

热门文章

  1. X线DR医学图像 --- 直方图的窗宽窗位调整(Matlab篇)
  2. LeetCode代码刷题(17~24)
  3. 通过fpga实现占空比的改变
  4. samba -smb开启v2协议
  5. 毕业论文-马尔可夫随机场
  6. 简单的计算机程序图,技巧:只需几个简单的步骤,即可使用Office工具离线识别图片文字...
  7. pom里配置阿里云仓库
  8. Clickhouse—字符串函数
  9. android 百度转码,关于百度移动端转码的问题与解决办法
  10. ubuntu20.04设置为中文