Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756007AbbGVHEz (ORCPT ); Wed, 22 Jul 2015 03:04:55 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:34751 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755487AbbGVHEx (ORCPT ); Wed, 22 Jul 2015 03:04:53 -0400 Date: Wed, 22 Jul 2015 12:34:48 +0530 From: Viresh Kumar To: "Rafael J. Wysocki" Cc: Russell King - ARM Linux , Rafael Wysocki , Lists linaro-kernel , "linux-pm@vger.kernel.org" , open list Subject: Re: [PATCH] cpufreq: Avoid double addition/removal of sysfs links Message-ID: <20150722070448.GC30970@linux> References: <20150718163149.GP7557@n2100.arm.linux.org.uk> <20150720103623.GQ7557@n2100.arm.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1302 Lines: 44 On 21-07-15, 03:14, Rafael J. Wysocki wrote: > That said, cpu_present_mask may only be updated after calling > arch_unregister_cpu(), so checking it in cpufreq_remove_dev() doesn't > really help. No, it is indeed useful. This is a snippet from the latest code we have: cpumask_copy(&mask, policy->related_cpus); cpumask_clear_cpu(cpu, &mask); /* * Free policy only if all policy->related_cpus are removed * physically. */ if (cpumask_intersects(&mask, cpu_present_mask)) { remove_cpu_dev_symlink(policy, cpu); return 0; } cpufreq_policy_free(policy, true); So what we are checking in the 'if' block is: "Is any CPU from related_cpus, apart from the one getting removed now, present in the system." If not, then free the policy. > It looks like using cpufreq_remove_dev() as the subsys ->remove_dev > callback is a mistake as it cannot really tell the difference between > that code path and the CPU offline one. What do you mean by this? Doesn't the sif parameter confirms that its called from subsys path ? -- viresh -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/