* [PATCH 0/2] scatterlist: clean up
@ 2017-02-02 12:55 Gilad Ben-Yossef
2017-02-02 12:55 ` [PATCH 1/2] scatterlist: reorder compound boolean expression Gilad Ben-Yossef
2017-02-02 12:55 ` [PATCH 2/2] scatterlist: do not disable IRQs in sg_copy_buffer Gilad Ben-Yossef
0 siblings, 2 replies; 3+ messages in thread
From: Gilad Ben-Yossef @ 2017-02-02 12:55 UTC (permalink / raw)
To: linux-kernel; +Cc: gilad.benyossef, ofir.drang
Ran into these two clean up / optimization opportunities while chasing
an unrelated bug.
Gilad Ben-Yossef (2):
scatterlist: reorder compound boolean expression
scatterlist: do not disable IRQs in sg_copy_buffer
lib/scatterlist.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
--
2.1.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] scatterlist: reorder compound boolean expression
2017-02-02 12:55 [PATCH 0/2] scatterlist: clean up Gilad Ben-Yossef
@ 2017-02-02 12:55 ` Gilad Ben-Yossef
2017-02-02 12:55 ` [PATCH 2/2] scatterlist: do not disable IRQs in sg_copy_buffer Gilad Ben-Yossef
1 sibling, 0 replies; 3+ messages in thread
From: Gilad Ben-Yossef @ 2017-02-02 12:55 UTC (permalink / raw)
To: linux-kernel; +Cc: gilad.benyossef, ofir.drang
Test the cheaper boolean expression with no side effects first.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
---
lib/scatterlist.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/scatterlist.c b/lib/scatterlist.c
index 004fc70..393920f 100644
--- a/lib/scatterlist.c
+++ b/lib/scatterlist.c
@@ -666,7 +666,7 @@ size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents, void *buf,
local_irq_save(flags);
- while (sg_miter_next(&miter) && offset < buflen) {
+ while ((offset < buflen) && sg_miter_next(&miter)) {
unsigned int len;
len = min(miter.length, buflen - offset);
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] scatterlist: do not disable IRQs in sg_copy_buffer
2017-02-02 12:55 [PATCH 0/2] scatterlist: clean up Gilad Ben-Yossef
2017-02-02 12:55 ` [PATCH 1/2] scatterlist: reorder compound boolean expression Gilad Ben-Yossef
@ 2017-02-02 12:55 ` Gilad Ben-Yossef
1 sibling, 0 replies; 3+ messages in thread
From: Gilad Ben-Yossef @ 2017-02-02 12:55 UTC (permalink / raw)
To: linux-kernel; +Cc: gilad.benyossef, ofir.drang
Commit 50bed2e2862a ("sg: disable interrupts inside sg_copy_buffer")
introduced disabling interrupts in sg_copy_buffer() since atomic uses of
miter required it due to use of kmap_atomic().
However, as commit 8290e2d2dcbf ("scatterlist: atomic sg_mapping_iter()
no longer needs disabled IRQs") acknowledges disabling interrupts is no
longer needed for calls to kmap_atomic() and therefore unneeded for miter
ops either, so remove it from sg_copy_buffer().
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
---
lib/scatterlist.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/lib/scatterlist.c b/lib/scatterlist.c
index 393920f..c6cf822 100644
--- a/lib/scatterlist.c
+++ b/lib/scatterlist.c
@@ -651,7 +651,6 @@ size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents, void *buf,
{
unsigned int offset = 0;
struct sg_mapping_iter miter;
- unsigned long flags;
unsigned int sg_flags = SG_MITER_ATOMIC;
if (to_buffer)
@@ -664,8 +663,6 @@ size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents, void *buf,
if (!sg_miter_skip(&miter, skip))
return false;
- local_irq_save(flags);
-
while ((offset < buflen) && sg_miter_next(&miter)) {
unsigned int len;
@@ -681,7 +678,6 @@ size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents, void *buf,
sg_miter_stop(&miter);
- local_irq_restore(flags);
return offset;
}
EXPORT_SYMBOL(sg_copy_buffer);
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-02-02 12:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-02 12:55 [PATCH 0/2] scatterlist: clean up Gilad Ben-Yossef
2017-02-02 12:55 ` [PATCH 1/2] scatterlist: reorder compound boolean expression Gilad Ben-Yossef
2017-02-02 12:55 ` [PATCH 2/2] scatterlist: do not disable IRQs in sg_copy_buffer Gilad Ben-Yossef
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).