shmem.c (1bdd3e05a0a3b4a97ea88bc46fef8fb265c8b94c) | shmem.c (991589974d9c9ecb24ee3799ec8c415c730598a2) |
---|---|
1/* 2 * Resizable virtual memory filesystem for Linux. 3 * 4 * Copyright (C) 2000 Linus Torvalds. 5 * 2000 Transmeta Corp. 6 * 2000-2001 Christoph Rohland 7 * 2000-2001 SAP AG 8 * 2002 Red Hat Inc. --- 2093 unchanged lines hidden (view full) --- 2102 return addr; 2103 if (len < HPAGE_PMD_SIZE) 2104 return addr; 2105 if (flags & MAP_FIXED) 2106 return addr; 2107 /* 2108 * Our priority is to support MAP_SHARED mapped hugely; 2109 * and support MAP_PRIVATE mapped hugely too, until it is COWed. | 1/* 2 * Resizable virtual memory filesystem for Linux. 3 * 4 * Copyright (C) 2000 Linus Torvalds. 5 * 2000 Transmeta Corp. 6 * 2000-2001 Christoph Rohland 7 * 2000-2001 SAP AG 8 * 2002 Red Hat Inc. --- 2093 unchanged lines hidden (view full) --- 2102 return addr; 2103 if (len < HPAGE_PMD_SIZE) 2104 return addr; 2105 if (flags & MAP_FIXED) 2106 return addr; 2107 /* 2108 * Our priority is to support MAP_SHARED mapped hugely; 2109 * and support MAP_PRIVATE mapped hugely too, until it is COWed. |
2110 * But if caller specified an address hint, respect that as before. | 2110 * But if caller specified an address hint and we allocated area there 2111 * successfully, respect that as before. |
2111 */ | 2112 */ |
2112 if (uaddr) | 2113 if (uaddr == addr) |
2113 return addr; 2114 2115 if (shmem_huge != SHMEM_HUGE_FORCE) { 2116 struct super_block *sb; 2117 2118 if (file) { 2119 VM_BUG_ON(file->f_op != &shmem_file_operations); 2120 sb = file_inode(file)->i_sb; --- 17 unchanged lines hidden (view full) --- 2138 return addr; 2139 2140 inflated_len = len + HPAGE_PMD_SIZE - PAGE_SIZE; 2141 if (inflated_len > TASK_SIZE) 2142 return addr; 2143 if (inflated_len < len) 2144 return addr; 2145 | 2114 return addr; 2115 2116 if (shmem_huge != SHMEM_HUGE_FORCE) { 2117 struct super_block *sb; 2118 2119 if (file) { 2120 VM_BUG_ON(file->f_op != &shmem_file_operations); 2121 sb = file_inode(file)->i_sb; --- 17 unchanged lines hidden (view full) --- 2139 return addr; 2140 2141 inflated_len = len + HPAGE_PMD_SIZE - PAGE_SIZE; 2142 if (inflated_len > TASK_SIZE) 2143 return addr; 2144 if (inflated_len < len) 2145 return addr; 2146 |
2146 inflated_addr = get_area(NULL, 0, inflated_len, 0, flags); | 2147 inflated_addr = get_area(NULL, uaddr, inflated_len, 0, flags); |
2147 if (IS_ERR_VALUE(inflated_addr)) 2148 return addr; 2149 if (inflated_addr & ~PAGE_MASK) 2150 return addr; 2151 2152 inflated_offset = inflated_addr & (HPAGE_PMD_SIZE-1); 2153 inflated_addr += offset - inflated_offset; 2154 if (inflated_offset > offset) --- 2083 unchanged lines hidden --- | 2148 if (IS_ERR_VALUE(inflated_addr)) 2149 return addr; 2150 if (inflated_addr & ~PAGE_MASK) 2151 return addr; 2152 2153 inflated_offset = inflated_addr & (HPAGE_PMD_SIZE-1); 2154 inflated_addr += offset - inflated_offset; 2155 if (inflated_offset > offset) --- 2083 unchanged lines hidden --- |