/images/avatar.jpg
杂七杂八的,随手记录。

How can 3ware and MegaRAID performance be increased in Linux?

本文为摘录(或转载),侵删,原文为: https://www.broadcom.com/support/knowledgebase/1211161453667/how-can-3ware-and-megaraid-performance-be-increased-in-linux

1 Question

How can LSI 3ware and LSI MegaRAID performance be increased in Linux?

2 Answer

2.1 For the Linux 2.6 kernel:

See KB article A004958 Article ID 1211161457978 See also: Article ID 1211161479669

Linux内核机制—spin_lock (转载)

本文为摘录(或转载),侵删,原文为: https://www.cnblogs.com/hellokitty2/p/16368024.html

1 pin_lock 概述

  1. spin lock 是一种不可休眠锁,可用于原子上下文。当获取不到锁的时候会 spin 等待,此时是 running 状态。

A Close Look at a Spinlock – Embedded in Academia

本文为摘录(或转载),侵删,原文为: https://blog.regehr.org/archives/2173

自旋锁 (spinlock) 是多处理器操作系统提供的最基本的互斥原语。自旋锁需要保护当前 CPU 免受抢占(通常通过禁用中断,但我们会在本文中忽略这个方面),并且还需要防止其他核心同时访问临界区(通过使用原子内存操作)。正如其名称所示,尝试获取已锁定的自旋锁会简单地自旋:它们会消耗 CPU 时间:

Note about PO file in PostgreSQL

Table of Contents

本文为摘录(或转载),侵删,原文为: https://github.com/postgres/postgres/blob/master/doc/src/sgml/nls.sgml#L52

1 Concepts

The pairs of original (English) messages and their (possibly) translated equivalents are kept in message catalogs , one for each program (although related programs can share a message catalog) and for each target language. There are two file formats for message catalogs: The first is the PO file (for Portable Object), which is a plain text file with special syntax that translators edit. The second is the MO file (for Machine Object), which is a binary file generated from the respective PO file and is used while the internationalized program is run. Translators do not deal with MO files; in fact hardly anyone does.

how to avoid memory being swapped (locking memory pages)

本文为摘录(或转载),侵删,原文为: https://stackoverflow.com/questions/12520499/linux-how-to-lock-the-pages-of-a-process-in-memory

1 mlockall()

from manpage:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

mlockall() and munlockall()
    mlockall() locks all pages mapped into the address space of the  calling  process.   This  in‐
    cludes the pages of the code, data, and stack segment, as well as shared libraries, user space
    kernel data, shared memory, and memory-mapped files.  All mapped pages are  guaranteed  to  be
    resident  in  RAM  when the call returns successfully; the pages are guaranteed to stay in RAM
    until later unlocked.

    The flags argument is constructed as the bitwise OR of one or more of the following constants:

    MCL_CURRENT
           Lock all pages which are currently mapped into the address space of the process.

    MCL_FUTURE
           Lock all pages which will become mapped into the address space of the  process  in  the
           future.   These  could be, for instance, new pages required by a growing heap and stack
           as well as new memory-mapped files or shared memory regions.

    MCL_ONFAULT (since Linux 4.4)
           Used together with MCL_CURRENT, MCL_FUTURE, or both.  Mark all current  (with  MCL_CUR‐
           RENT)  or  future  (with  MCL_FUTURE)  mappings to lock pages when they are faulted in.
           When used with MCL_CURRENT, all present pages are locked, but mlockall() will not fault
           in non-present pages.  When used with MCL_FUTURE, all future mappings will be marked to
           lock pages when they are faulted in, but they will not be populated by  the  lock  when
           the mapping is created.  MCL_ONFAULT must be used with either MCL_CURRENT or MCL_FUTURE
           or both.

    If MCL_FUTURE has been specified, then a later  system  call  (e.g.,  mmap(2),  sbrk(2),  mal‐
    loc(3)), may fail if it would cause the number of locked bytes to exceed the permitted maximum
    (see below).  In the same circumstances, stack growth may likewise fail: the kernel will  deny
    stack expansion and deliver a SIGSEGV signal to the process.

munlockall() unlocks all pages mapped into the address space of the calling process.

2 how to do this after program started and program does not call mlockall() ?

Make a GDB command file that contains something like this: