~ubuntu-branches/ubuntu/karmic/linux-fsl-imx51/karmic

« back to all changes in this revision

Viewing changes to mm/swap_state.c

  • Committer: Bazaar Package Importer
  • Author(s): Andy Whitcroft, Andy Whitcroft, Upstream Kernel Changes, Ubuntu: 2.6.31-14.46, Ubuntu: 2.6.31-13.45, Ubuntu: 2.6.31-13.44
  • Date: 2009-10-13 15:59:33 UTC
  • Revision ID: james.westby@ubuntu.com-20091013155933-hxzquigs9nqajd9x
Tags: 2.6.31-105.14
[ Andy Whitcroft ]

* rebase to Ubuntu-2.6.31-14.46
* [Config] update configs since rebase to Ubuntu-2.6.31-14.46
* lirc update dropped module lirc_mceusb2

[ Upstream Kernel Changes ]

* mxc spi: fix spi driver for 2.6.31
  - LP: #427289, #446140

[ Ubuntu: 2.6.31-14.46 ]

* reinstate armel.mk with no flavours
  - LP: #449637
* [Upstream] elevator: fix fastfail checks to allow merge of readahead
  requests
  - LP: #444915
* [Upstream] block: silently error unsupported empty barriers too
  - LP: #420423
* SAUCE: AppArmor: Fix mediation of "deleted" paths
  - LP: #415632
* [Config] CONFIG_X86_MCE
  https://lists.ubuntu.com/archives/kernel-team/2009-October/007584.html
* Revert "appletalk: Fix skb leak when ipddp interface is not loaded,
  CVE-2009-2903" - Use patch from 2.6.31.4 which is slightly different.
* x86: fix csum_ipv6_magic asm memory clobber
* tty: Avoid dropping ldisc_mutex over hangup tty re-initialization
* x86: Don't leak 64-bit kernel register values to 32-bit processes
* tracing: correct module boundaries for ftrace_release
* ftrace: check for failure for all conversions
* futex: fix requeue_pi key imbalance
* futex: Move exit_pi_state() call to release_mm()
* futex: Nullify robust lists after cleanup
* futex: Fix locking imbalance
* NOHZ: update idle state also when NOHZ is inactive
* ima: ecryptfs fix imbalance message
* libata: fix incorrect link online check during probe
* sound: via82xx: move DXS volume controls to PCM interface
* ASoC: WM8350 capture PGA mutes are inverted
* KVM: Prevent overflow in KVM_GET_SUPPORTED_CPUID
* KVM: VMX: flush TLB with INVEPT on cpu migration
* KVM: fix LAPIC timer period overflow
* KVM: SVM: Fix tsc offset adjustment when running nested
* KVM: SVM: Handle tsc in svm_get_msr/svm_set_msr correctly
* net: Fix wrong sizeof
* mm: add_to_swap_cache() must not sleep
* sis5513: fix PIO setup for ATAPI devices
* PIT fixes to unbreak suspend/resume (bug #14222)
* IMA: open new file for read
* ACPI: Clarify resource conflict message
* ACPI: fix Compaq Evo N800c (Pentium 4m) boot hang regression
* net: restore tx timestamping for accelerated vlans
* net: unix: fix sending fds in multiple buffers
* tun: Return -EINVAL if neither IFF_TUN nor IFF_TAP is set.
* tcp: fix CONFIG_TCP_MD5SIG + CONFIG_PREEMPT timer BUG()
* net: Fix sock_wfree() race
* smsc95xx: fix transmission where ZLP is expected
* sky2: Set SKY2_HW_RAM_BUFFER in sky2_init
* appletalk: Fix skb leak when ipddp interface is not loaded
* ax25: Fix possible oops in ax25_make_new
* ax25: Fix SIOCAX25GETINFO ioctl
* sit: fix off-by-one in ipip6_tunnel_get_prl
* Linux 2.6.31.4
* drm/i915: Fix FDI M/N setting according with correct color depth
  - LP: #416792

[ Ubuntu: 2.6.31-13.45 ]

* [Config] Add sd_mod to scsi-modules udeb for powerpc
* SAUCE: Update to LIRC 0.8.6
  - LP: #432678
* [Config] CONFIG_X86_PAT=y
  https://lists.ubuntu.com/archives/kernel-team/2009-October/007477.html
  https://lists.ubuntu.com/archives/kernel-team/2009-October/007534.html
* [Config] Add armel arch to linux-libc-dev arches.
  - LP: #449637
* e1000e: swap max hw supported frame size between 82574 and 82583
* drm/i915: Initialize HDMI outputs as HDMI connectors, not DVI.
  - LP: #392017
* ALSA: hda - Add quirks for some HP laptops
  - LP: #449742
* ALSA: hda - Add support for HP dv6
  - LP: #449742

[ Ubuntu: 2.6.31-13.44 ]

* sgi-gru: Fix kernel stack buffer overrun, CVE-2009-2584
* appletalk: Fix skb leak when ipddp interface is not loaded,
  CVE-2009-2903
  Note - This patch causes an ABI change in the symbol aarp_send_ddp
  which I'm ignoring.

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
}
67
67
 
68
68
/*
69
 
 * add_to_swap_cache resembles add_to_page_cache_locked on swapper_space,
 
69
 * __add_to_swap_cache resembles add_to_page_cache_locked on swapper_space,
70
70
 * but sets SwapCache flag and private instead of mapping and index.
71
71
 */
72
 
int add_to_swap_cache(struct page *page, swp_entry_t entry, gfp_t gfp_mask)
 
72
static int __add_to_swap_cache(struct page *page, swp_entry_t entry)
73
73
{
74
74
        int error;
75
75
 
77
77
        VM_BUG_ON(PageSwapCache(page));
78
78
        VM_BUG_ON(!PageSwapBacked(page));
79
79
 
 
80
        page_cache_get(page);
 
81
        SetPageSwapCache(page);
 
82
        set_page_private(page, entry.val);
 
83
 
 
84
        spin_lock_irq(&swapper_space.tree_lock);
 
85
        error = radix_tree_insert(&swapper_space.page_tree, entry.val, page);
 
86
        if (likely(!error)) {
 
87
                total_swapcache_pages++;
 
88
                __inc_zone_page_state(page, NR_FILE_PAGES);
 
89
                INC_CACHE_INFO(add_total);
 
90
        }
 
91
        spin_unlock_irq(&swapper_space.tree_lock);
 
92
 
 
93
        if (unlikely(error)) {
 
94
                set_page_private(page, 0UL);
 
95
                ClearPageSwapCache(page);
 
96
                page_cache_release(page);
 
97
        }
 
98
 
 
99
        return error;
 
100
}
 
101
 
 
102
 
 
103
int add_to_swap_cache(struct page *page, swp_entry_t entry, gfp_t gfp_mask)
 
104
{
 
105
        int error;
 
106
 
80
107
        error = radix_tree_preload(gfp_mask);
81
108
        if (!error) {
82
 
                page_cache_get(page);
83
 
                SetPageSwapCache(page);
84
 
                set_page_private(page, entry.val);
85
 
 
86
 
                spin_lock_irq(&swapper_space.tree_lock);
87
 
                error = radix_tree_insert(&swapper_space.page_tree,
88
 
                                                entry.val, page);
89
 
                if (likely(!error)) {
90
 
                        total_swapcache_pages++;
91
 
                        __inc_zone_page_state(page, NR_FILE_PAGES);
92
 
                        INC_CACHE_INFO(add_total);
93
 
                }
94
 
                spin_unlock_irq(&swapper_space.tree_lock);
 
109
                error = __add_to_swap_cache(page, entry);
95
110
                radix_tree_preload_end();
96
 
 
97
 
                if (unlikely(error)) {
98
 
                        set_page_private(page, 0UL);
99
 
                        ClearPageSwapCache(page);
100
 
                        page_cache_release(page);
101
 
                }
102
111
        }
103
112
        return error;
104
113
}
289
298
                }
290
299
 
291
300
                /*
 
301
                 * call radix_tree_preload() while we can wait.
 
302
                 */
 
303
                err = radix_tree_preload(gfp_mask & GFP_KERNEL);
 
304
                if (err)
 
305
                        break;
 
306
 
 
307
                /*
292
308
                 * Swap entry may have been freed since our caller observed it.
293
309
                 */
294
310
                err = swapcache_prepare(entry);
295
 
                if (err == -EEXIST) /* seems racy */
 
311
                if (err == -EEXIST) {   /* seems racy */
 
312
                        radix_tree_preload_end();
296
313
                        continue;
297
 
                if (err)           /* swp entry is obsolete ? */
 
314
                }
 
315
                if (err) {              /* swp entry is obsolete ? */
 
316
                        radix_tree_preload_end();
298
317
                        break;
 
318
                }
299
319
 
300
320
                /*
301
321
                 * Associate the page with swap entry in the swap cache.
307
327
                 */
308
328
                __set_page_locked(new_page);
309
329
                SetPageSwapBacked(new_page);
310
 
                err = add_to_swap_cache(new_page, entry, gfp_mask & GFP_KERNEL);
 
330
                err = __add_to_swap_cache(new_page, entry);
311
331
                if (likely(!err)) {
 
332
                        radix_tree_preload_end();
312
333
                        /*
313
334
                         * Initiate read into locked page and return.
314
335
                         */
316
337
                        swap_readpage(new_page);
317
338
                        return new_page;
318
339
                }
 
340
                radix_tree_preload_end();
319
341
                ClearPageSwapBacked(new_page);
320
342
                __clear_page_locked(new_page);
321
343
                swapcache_free(entry, NULL);