linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] memory/samsung: reduce unnecessary mutex lock area
@ 2020-05-12 11:08 Bernard Zhao
  0 siblings, 0 replies; 3+ messages in thread
From: Bernard Zhao @ 2020-05-12 11:08 UTC (permalink / raw)
  To: Lukasz Luba, Kukjin Kim, Krzysztof Kozlowski, linux-pm,
	linux-samsung-soc, linux-arm-kernel, linux-kernel
  Cc: opensource.kernel, Bernard Zhao

Maybe dmc->df->lock seems not needed to protect "if (ret)
& dev_warn" branch. Maybe this change speed up the code a bit.

Signed-off-by: Bernard Zhao <bernard@vivo.com>
----
Changes since v1:
*change release lock before the if statement.
*revert dmc->df->lock mutex lock to protect function
exynos5_dmc_perf_events_check
Link for V1:
*https://lore.kernel.org/patchwork/patch/1238888/
---
 drivers/memory/samsung/exynos5422-dmc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/memory/samsung/exynos5422-dmc.c b/drivers/memory/samsung/exynos5422-dmc.c
index 22a43d662833..25196d6268e2 100644
--- a/drivers/memory/samsung/exynos5422-dmc.c
+++ b/drivers/memory/samsung/exynos5422-dmc.c
@@ -1346,15 +1346,13 @@ static irqreturn_t dmc_irq_thread(int irq, void *priv)
 	struct exynos5_dmc *dmc = priv;
 
 	mutex_lock(&dmc->df->lock);
-
 	exynos5_dmc_perf_events_check(dmc);
-
 	res = update_devfreq(dmc->df);
+	mutex_unlock(&dmc->df->lock);
+
 	if (res)
 		dev_warn(dmc->dev, "devfreq failed with %d\n", res);
 
-	mutex_unlock(&dmc->df->lock);
-
 	return IRQ_HANDLED;
 }
 
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] memory/samsung: reduce unnecessary mutex lock area
  2020-05-12 11:40 Markus Elfring
@ 2020-05-12 11:56 ` Lukasz Luba
  0 siblings, 0 replies; 3+ messages in thread
From: Lukasz Luba @ 2020-05-12 11:56 UTC (permalink / raw)
  To: Markus Elfring, Bernard Zhao, linux-arm-kernel, linux-pm,
	linux-samsung-soc
  Cc: linux-kernel, opensource.kernel, Krzysztof Kozlowski, Kukjin Kim



On 5/12/20 12:40 PM, Markus Elfring wrote:
>> Maybe dmc->df->lock seems not needed to protect "if (ret)
>> & dev_warn" branch. Maybe this change speed up the code a bit.
> 
> I suggest to improve also this commit message.
> 
> * Please reduce uncertainty.
> 
> * An imperative wording is probably preferred, isn't it?
>    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=152036d1379ffd6985262743dcf6b0f9c75f83a4#n151
> 
> * Will it be more appropriate to refer to the transformation “Reduce the lock scope”?
> 
> * Would you like to add the tag “Fixes” to the change description?
> 
> Regards,
> Markus
> 

Thank you Markus for providing to Bernard helpful suggestions.

@Bernard please read the link above and send v3

Something like: 'memory/samsung: reduce protected code area in IRQ
handler' for the subject header would be better.
Then in the message explain (without 'maybe') that it will speed-up a
bit this IRQ processing and there is no need to protect return value or
printing.

Regards,
Lukasz

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] memory/samsung: reduce unnecessary mutex lock area
@ 2020-05-12 11:40 Markus Elfring
  2020-05-12 11:56 ` Lukasz Luba
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2020-05-12 11:40 UTC (permalink / raw)
  To: Bernard Zhao, linux-arm-kernel, linux-pm, linux-samsung-soc
  Cc: linux-kernel, opensource.kernel, Krzysztof Kozlowski, Kukjin Kim,
	Lukasz Luba

> Maybe dmc->df->lock seems not needed to protect "if (ret)
> & dev_warn" branch. Maybe this change speed up the code a bit.

I suggest to improve also this commit message.

* Please reduce uncertainty.

* An imperative wording is probably preferred, isn't it?
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=152036d1379ffd6985262743dcf6b0f9c75f83a4#n151

* Will it be more appropriate to refer to the transformation “Reduce the lock scope”?

* Would you like to add the tag “Fixes” to the change description?

Regards,
Markus

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-12 11:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-12 11:08 [PATCH v2] memory/samsung: reduce unnecessary mutex lock area Bernard Zhao
2020-05-12 11:40 Markus Elfring
2020-05-12 11:56 ` Lukasz Luba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).