From 484fb5539fb23d8a1e7319f67996231561933ba3 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 7 Jun 2011 15:14:26 -0400 Subject: [PATCH] --- yaml --- r: 253783 b: refs/heads/master c: 808b4e639eb00394de9989fabca23196c337ee75 h: refs/heads/master i: 253781: 2e09237d8246ee729015cf978b0754ebcf11c840 253779: de7b73a6c74637a028a313a5fbcb05fa0bbaf130 253775: 177b272367fe741d5a614ea6b9ca1e70513cc9a4 v: v3 --- [refs] | 2 +- trunk/drivers/cpufreq/cpufreq_stats.c | 8 +- trunk/drivers/cpufreq/powernow-k8.c | 6 +- trunk/drivers/gpu/drm/i915/i915_irq.c | 10 --- trunk/drivers/hwmon/coretemp.c | 4 - trunk/fs/isofs/inode.c | 3 +- trunk/mm/rmap.c | 106 ++++++++------------------ 7 files changed, 37 insertions(+), 102 deletions(-) diff --git a/[refs] b/[refs] index a044ea2777c6..bd6aa3167e13 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c11760c6d80ab6aa20e383cf378a7287305f591c +refs/heads/master: 808b4e639eb00394de9989fabca23196c337ee75 diff --git a/trunk/drivers/cpufreq/cpufreq_stats.c b/trunk/drivers/cpufreq/cpufreq_stats.c index faf7c5217848..853f92d23ddb 100644 --- a/trunk/drivers/cpufreq/cpufreq_stats.c +++ b/trunk/drivers/cpufreq/cpufreq_stats.c @@ -298,15 +298,13 @@ static int cpufreq_stat_notifier_trans(struct notifier_block *nb, old_index = stat->last_index; new_index = freq_table_get_index(stat, freq->new); - /* We can't do stat->time_in_state[-1]= .. */ - if (old_index == -1 || new_index == -1) - return 0; - cpufreq_stats_update(freq->cpu); - if (old_index == new_index) return 0; + if (old_index == -1 || new_index == -1) + return 0; + spin_lock(&cpufreq_stats_lock); stat->last_index = new_index; #ifdef CONFIG_CPU_FREQ_STAT_DETAILS diff --git a/trunk/drivers/cpufreq/powernow-k8.c b/trunk/drivers/cpufreq/powernow-k8.c index bce576d7478e..83479b6fb9a1 100644 --- a/trunk/drivers/cpufreq/powernow-k8.c +++ b/trunk/drivers/cpufreq/powernow-k8.c @@ -1079,9 +1079,6 @@ static int transition_frequency_fidvid(struct powernow_k8_data *data, } res = transition_fid_vid(data, fid, vid); - if (res) - return res; - freqs.new = find_khz_freq_from_fid(data->currfid); for_each_cpu(i, data->available_cores) { @@ -1104,8 +1101,7 @@ static int transition_frequency_pstate(struct powernow_k8_data *data, /* get MSR index for hardware pstate transition */ pstate = index & HW_PSTATE_MASK; if (pstate > data->max_hw_pstate) - return -EINVAL; - + return 0; freqs.old = find_khz_freq_from_pstate(data->powernow_table, data->currpstate); freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate); diff --git a/trunk/drivers/gpu/drm/i915/i915_irq.c b/trunk/drivers/gpu/drm/i915/i915_irq.c index 9e34a1abeb61..b9fafe3b045b 100644 --- a/trunk/drivers/gpu/drm/i915/i915_irq.c +++ b/trunk/drivers/gpu/drm/i915/i915_irq.c @@ -1740,16 +1740,6 @@ void ironlake_irq_preinstall(struct drm_device *dev) INIT_WORK(&dev_priv->rps_work, gen6_pm_rps_work); I915_WRITE(HWSTAM, 0xeffe); - if (IS_GEN6(dev)) { - /* Workaround stalls observed on Sandy Bridge GPUs by - * making the blitter command streamer generate a - * write to the Hardware Status Page for - * MI_USER_INTERRUPT. This appears to serialize the - * previous seqno write out before the interrupt - * happens. - */ - I915_WRITE(GEN6_BLITTER_HWSTAM, ~GEN6_BLITTER_USER_INTERRUPT); - } /* XXX hotplug from PCH */ diff --git a/trunk/drivers/hwmon/coretemp.c b/trunk/drivers/hwmon/coretemp.c index 85e937984ff7..0070d5476dd0 100644 --- a/trunk/drivers/hwmon/coretemp.c +++ b/trunk/drivers/hwmon/coretemp.c @@ -97,9 +97,7 @@ struct platform_data { struct pdev_entry { struct list_head list; struct platform_device *pdev; - unsigned int cpu; u16 phys_proc_id; - u16 cpu_core_id; }; static LIST_HEAD(pdev_list); @@ -653,9 +651,7 @@ static int __cpuinit coretemp_device_add(unsigned int cpu) } pdev_entry->pdev = pdev; - pdev_entry->cpu = cpu; pdev_entry->phys_proc_id = TO_PHYS_ID(cpu); - pdev_entry->cpu_core_id = TO_CORE_ID(cpu); list_add_tail(&pdev_entry->list, &pdev_list); mutex_unlock(&pdev_list_mutex); diff --git a/trunk/fs/isofs/inode.c b/trunk/fs/isofs/inode.c index b3cc8586984e..3db5ba4568fc 100644 --- a/trunk/fs/isofs/inode.c +++ b/trunk/fs/isofs/inode.c @@ -974,7 +974,7 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent) out_no_read: printk(KERN_WARNING "%s: bread failed, dev=%s, iso_blknum=%d, block=%d\n", __func__, s->s_id, iso_blknum, block); - goto out_freebh; + goto out_freesbi; out_bad_zone_size: printk(KERN_WARNING "ISOFS: Bad logical zone size %ld\n", sbi->s_log_zone_size); @@ -989,7 +989,6 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent) out_freebh: brelse(bh); - brelse(pri_bh); out_freesbi: kfree(opt.iocharset); kfree(sbi); diff --git a/trunk/mm/rmap.c b/trunk/mm/rmap.c index 27dfd3b82b0f..0eb463ea88dd 100644 --- a/trunk/mm/rmap.c +++ b/trunk/mm/rmap.c @@ -112,9 +112,9 @@ static inline void anon_vma_free(struct anon_vma *anon_vma) kmem_cache_free(anon_vma_cachep, anon_vma); } -static inline struct anon_vma_chain *anon_vma_chain_alloc(gfp_t gfp) +static inline struct anon_vma_chain *anon_vma_chain_alloc(void) { - return kmem_cache_alloc(anon_vma_chain_cachep, gfp); + return kmem_cache_alloc(anon_vma_chain_cachep, GFP_KERNEL); } static void anon_vma_chain_free(struct anon_vma_chain *anon_vma_chain) @@ -159,7 +159,7 @@ int anon_vma_prepare(struct vm_area_struct *vma) struct mm_struct *mm = vma->vm_mm; struct anon_vma *allocated; - avc = anon_vma_chain_alloc(GFP_KERNEL); + avc = anon_vma_chain_alloc(); if (!avc) goto out_enomem; @@ -200,32 +200,6 @@ int anon_vma_prepare(struct vm_area_struct *vma) return -ENOMEM; } -/* - * This is a useful helper function for locking the anon_vma root as - * we traverse the vma->anon_vma_chain, looping over anon_vma's that - * have the same vma. - * - * Such anon_vma's should have the same root, so you'd expect to see - * just a single mutex_lock for the whole traversal. - */ -static inline struct anon_vma *lock_anon_vma_root(struct anon_vma *root, struct anon_vma *anon_vma) -{ - struct anon_vma *new_root = anon_vma->root; - if (new_root != root) { - if (WARN_ON_ONCE(root)) - mutex_unlock(&root->mutex); - root = new_root; - mutex_lock(&root->mutex); - } - return root; -} - -static inline void unlock_anon_vma_root(struct anon_vma *root) -{ - if (root) - mutex_unlock(&root->mutex); -} - static void anon_vma_chain_link(struct vm_area_struct *vma, struct anon_vma_chain *avc, struct anon_vma *anon_vma) @@ -234,11 +208,13 @@ static void anon_vma_chain_link(struct vm_area_struct *vma, avc->anon_vma = anon_vma; list_add(&avc->same_vma, &vma->anon_vma_chain); + anon_vma_lock(anon_vma); /* * It's critical to add new vmas to the tail of the anon_vma, * see comment in huge_memory.c:__split_huge_page(). */ list_add_tail(&avc->same_anon_vma, &anon_vma->head); + anon_vma_unlock(anon_vma); } /* @@ -248,24 +224,13 @@ static void anon_vma_chain_link(struct vm_area_struct *vma, int anon_vma_clone(struct vm_area_struct *dst, struct vm_area_struct *src) { struct anon_vma_chain *avc, *pavc; - struct anon_vma *root = NULL; list_for_each_entry_reverse(pavc, &src->anon_vma_chain, same_vma) { - struct anon_vma *anon_vma; - - avc = anon_vma_chain_alloc(GFP_NOWAIT | __GFP_NOWARN); - if (unlikely(!avc)) { - unlock_anon_vma_root(root); - root = NULL; - avc = anon_vma_chain_alloc(GFP_KERNEL); - if (!avc) - goto enomem_failure; - } - anon_vma = pavc->anon_vma; - root = lock_anon_vma_root(root, anon_vma); - anon_vma_chain_link(dst, avc, anon_vma); + avc = anon_vma_chain_alloc(); + if (!avc) + goto enomem_failure; + anon_vma_chain_link(dst, avc, pavc->anon_vma); } - unlock_anon_vma_root(root); return 0; enomem_failure: @@ -298,7 +263,7 @@ int anon_vma_fork(struct vm_area_struct *vma, struct vm_area_struct *pvma) anon_vma = anon_vma_alloc(); if (!anon_vma) goto out_error; - avc = anon_vma_chain_alloc(GFP_KERNEL); + avc = anon_vma_chain_alloc(); if (!avc) goto out_error_free_anon_vma; @@ -315,9 +280,7 @@ int anon_vma_fork(struct vm_area_struct *vma, struct vm_area_struct *pvma) get_anon_vma(anon_vma->root); /* Mark this anon_vma as the one where our new (COWed) pages go. */ vma->anon_vma = anon_vma; - anon_vma_lock(anon_vma); anon_vma_chain_link(vma, avc, anon_vma); - anon_vma_unlock(anon_vma); return 0; @@ -328,43 +291,36 @@ int anon_vma_fork(struct vm_area_struct *vma, struct vm_area_struct *pvma) return -ENOMEM; } -void unlink_anon_vmas(struct vm_area_struct *vma) +static void anon_vma_unlink(struct anon_vma_chain *anon_vma_chain) { - struct anon_vma_chain *avc, *next; - struct anon_vma *root = NULL; + struct anon_vma *anon_vma = anon_vma_chain->anon_vma; + int empty; - /* - * Unlink each anon_vma chained to the VMA. This list is ordered - * from newest to oldest, ensuring the root anon_vma gets freed last. - */ - list_for_each_entry_safe(avc, next, &vma->anon_vma_chain, same_vma) { - struct anon_vma *anon_vma = avc->anon_vma; + /* If anon_vma_fork fails, we can get an empty anon_vma_chain. */ + if (!anon_vma) + return; - root = lock_anon_vma_root(root, anon_vma); - list_del(&avc->same_anon_vma); + anon_vma_lock(anon_vma); + list_del(&anon_vma_chain->same_anon_vma); - /* - * Leave empty anon_vmas on the list - we'll need - * to free them outside the lock. - */ - if (list_empty(&anon_vma->head)) - continue; + /* We must garbage collect the anon_vma if it's empty */ + empty = list_empty(&anon_vma->head); + anon_vma_unlock(anon_vma); - list_del(&avc->same_vma); - anon_vma_chain_free(avc); - } - unlock_anon_vma_root(root); + if (empty) + put_anon_vma(anon_vma); +} + +void unlink_anon_vmas(struct vm_area_struct *vma) +{ + struct anon_vma_chain *avc, *next; /* - * Iterate the list once more, it now only contains empty and unlinked - * anon_vmas, destroy them. Could not do before due to __put_anon_vma() - * needing to acquire the anon_vma->root->mutex. + * Unlink each anon_vma chained to the VMA. This list is ordered + * from newest to oldest, ensuring the root anon_vma gets freed last. */ list_for_each_entry_safe(avc, next, &vma->anon_vma_chain, same_vma) { - struct anon_vma *anon_vma = avc->anon_vma; - - put_anon_vma(anon_vma); - + anon_vma_unlink(avc); list_del(&avc->same_vma); anon_vma_chain_free(avc); }