�� �� isll (��雪) �拇������到: ��
: ��谢谢����陌�忙
������:)
: �谋�����写�模��铱���������通��vmalloc���������页ms����������去��
: ��vmalloc���������页(kmalloc)���被������去������话��������坛�峡����模������谋����辖��模��业玫��拇�����实����说�木���vmalloc��kmalloc���������页������swap��去����思��
�裕�确实��恕�映�到系统�占��页�都���被������去����������������为系统�占�����诖�
: ����凇�vmalloc�牟�����一����通��kmalloc����一���植��山������存”���业玫��拇鸶春�����说�摹�vmalloc�����kmalloc�����������������������亩��蟆保�应����一����思���业������芫���
: void * __vmalloc (unsigned long size, int gfp_mask, pgprot_t prot)
: {
: void * addr;
: struct vm_struct *area;
: size = PAGE_ALIGN(size);
: if (!size || (size >> PAGE_SHIFT) > num_physpages) {
: BUG();
: return NULL;
: }
: ������ area = get_vm_area(size, VM_ALLOC);
: struct vm_struct * get_vm_area(unsigned long size, unsigned long flags)
: {
: unsigned long addr;
: struct vm_struct **p, *tmp, *area;
: ������ area = (struct vm_struct *) kmalloc(sizeof(*area), GFP_KERNEL);
: 也����ulk2����说��
: The function first calls kmalloc( ) to obtain a memory area for the new descriptor. It then scans the list of descriptors of type struct vm_struct looking for an available range of linear addresses that includes at least size+4096 addresses.
: ����拇�������2.4�峡����模�������2.6�洗�������同��
: void *__vmalloc(unsigned long size, int gfp_mask, pgprot_t prot)
: {
: ��������������
: nr_pages = size >> PAGE_SHIFT;
: array_size = (nr_pages * sizeof(struct page *));
: area->nr_pages = nr_pages;
: /* Please note that the recursion is strictly bounded. */
: if (array_size > PAGE_SIZE)
: pages = __vmalloc(array_size, gfp_mask, PAGE_KERNEL);
: else
: pages = kmalloc(array_size, (gfp_mask & ~__GFP_HIGHMEM));
: ��������������
: }
: ����understanding the linux virtual memory manager������说��2.6��vmalloc��2.4应�貌�鸩淮���要�化为
: vmalloc_area_pages��2.4������map_vm_area(2.6)������2.6������kmalloc��vmalloc��������啥�兀�
������煤���前����偷�应��没�变化���铱�2.6���诖�����时��没�蟹�����胤���什么��变化
: ���诟叨��存,����些�胤���太�解,������2.4.17����拇��,
: fixmap.h������
: enum fixed_addresses {
: #ifdef CONFIG_X86_LOCAL_APIC
: FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
: #endif
: #ifdef CONFIG_X86_IO_APIC
: FIX_IO_APIC_BASE_0,
: FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1,
: #endif
: #ifdef CONFIG_X86_VISWS_APIC
: FIX_CO_CPU, /* Cobalt timer */
: FIX_CO_APIC, /* Cobalt APIC Redirection Table */
: FIX_LI_PCIA, /* Lithium PCI Bridge A */
: FIX_LI_PCIB, /* Lithium PCI Bridge B */
: #endif
: #ifdef CONFIG_HIGHMEM
: FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */
: FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
: #endif
: __end_of_fixed_addresses
: };
: �约��� include/linux/highmem.h ��没�卸��� CONFIG_HIGHMEM 时, ��
: void *kmap(struct page *page)
: { return page_address(page); }
: #define page_address(page) ((page)->virtual)
: ���诙�����CONFIG_HIGHMEM 时�定���为:
: include/linux/asm_i386/highmem.h
: static inline void *kmap(struct page *page)
: {
: if (in_interrupt())
: BUG();
: if (page < highmem_start_page)
: return page_address(page);
������说���page�牡�址����896M,直��+3G��映�到�诤����蔚�址�占�
: return kmap_high(page);
�����������亩愿叨��诖��映��
: }
: 通�����������约���understanding the linux virtual memory manager����说��Fixed virtual addresses are needed for subsystems that need to know the virtual address at compile time such as the APIC. FIXADDR TOP is statically defined to be 0xFFFFE000 on th
: ������一�����系统没��define APIC�����������诖�也没�谐���896M����也没�卸���CONFIG_HIGHMEM ������么�欠�筒�����fixed_address��
���应��������
: 同���欠���������存超��896M����������CONFIG_HIGHMEM��������没�卸���APIC���遣�����时�墓潭�映������也����fixed_address����只��kmap�����兀�
��说��kmap������什么��思?�也��呛�����
: ����一�������牵��������苫�vmalloc�芊�映��叨说������诖��耍�����ulk2�����到
: In short, allocation of high-memory page frames must be done only through the alloc_pages( ) function and its alloc_page( ) shortcut, which both return the address of the page descriptor of the first allocated page frame. Once allocated, a high-memor
��实��位�����思��说�不��通��get_free_page()����暮���直�拥玫������页������蔚�址����������alloc_pages�����玫�页��������然��使��������位����到�����只��贫苑���������址����映��
: To do this, the kernel may use three different mechanisms, which are called permanent kernel mappings, temporary kernel mappings, and noncontiguous memory allocation. In this section, we focus on the first two techniques; the third one is discussed i
: ���������实���vmalloc�遣�����映������叨��诖����诘����械������存,��映�工�������������到�幕��诨���法��alloc_page(s)��实�值模�同��模�ldd����说��叨��诖���������映���没���蹋�high memory tends to be reserved for user-space process pages���������
����������卤����遣����缘模����嵌���PAE支�值��诤��揖筒������
��么����头�械��伟�������
--
[m[1;32m�� ��源:��水木���� newsmth.net��[FROM: 202.118.70.*][m