* [PATCH] RDMA/rxe: remove redundant assignment to variable page_offset @ 2025-10-14 12:03 Colin Ian King 2025-10-14 14:41 ` Zhu Yanjun 2025-10-19 12:06 ` Leon Romanovsky 0 siblings, 2 replies; 3+ messages in thread From: Colin Ian King @ 2025-10-14 12:03 UTC (permalink / raw) To: Zhu Yanjun, Jason Gunthorpe, Leon Romanovsky, linux-rdma Cc: kernel-janitors, linux-kernel The variable page_offset is being assigned a value at the start of a loop and being redundantly zero'd at the end of the loop, there is no code that reads the zero'd value. The assignment is redundant and can be removed. Signed-off-by: Colin Ian King <coking@nvidia.com> --- drivers/infiniband/sw/rxe/rxe_mr.c | 1 - drivers/infiniband/sw/rxe/rxe_odp.c | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c index bcb97b3ea58a..b1df05238848 100644 --- a/drivers/infiniband/sw/rxe/rxe_mr.c +++ b/drivers/infiniband/sw/rxe/rxe_mr.c @@ -452,7 +452,6 @@ static int rxe_mr_flush_pmem_iova(struct rxe_mr *mr, u64 iova, unsigned int leng length -= bytes; iova += bytes; - page_offset = 0; } return 0; diff --git a/drivers/infiniband/sw/rxe/rxe_odp.c b/drivers/infiniband/sw/rxe/rxe_odp.c index f58e3ec6252f..ae71812bea82 100644 --- a/drivers/infiniband/sw/rxe/rxe_odp.c +++ b/drivers/infiniband/sw/rxe/rxe_odp.c @@ -358,7 +358,6 @@ int rxe_odp_flush_pmem_iova(struct rxe_mr *mr, u64 iova, length -= bytes; iova += bytes; - page_offset = 0; } mutex_unlock(&umem_odp->umem_mutex); -- 2.51.0 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] RDMA/rxe: remove redundant assignment to variable page_offset 2025-10-14 12:03 [PATCH] RDMA/rxe: remove redundant assignment to variable page_offset Colin Ian King @ 2025-10-14 14:41 ` Zhu Yanjun 2025-10-19 12:06 ` Leon Romanovsky 1 sibling, 0 replies; 3+ messages in thread From: Zhu Yanjun @ 2025-10-14 14:41 UTC (permalink / raw) To: Colin Ian King, Zhu Yanjun, Jason Gunthorpe, Leon Romanovsky, linux-rdma Cc: kernel-janitors, linux-kernel 在 2025/10/14 5:03, Colin Ian King 写道: > The variable page_offset is being assigned a value at the start of > a loop and being redundantly zero'd at the end of the loop, there > is no code that reads the zero'd value. The assignment is redundant > and can be removed. > > Signed-off-by: Colin Ian King <coking@nvidia.com> > --- > drivers/infiniband/sw/rxe/rxe_mr.c | 1 - > drivers/infiniband/sw/rxe/rxe_odp.c | 1 - > 2 files changed, 2 deletions(-) > > diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c > index bcb97b3ea58a..b1df05238848 100644 > --- a/drivers/infiniband/sw/rxe/rxe_mr.c > +++ b/drivers/infiniband/sw/rxe/rxe_mr.c > @@ -452,7 +452,6 @@ static int rxe_mr_flush_pmem_iova(struct rxe_mr *mr, u64 iova, unsigned int leng > > length -= bytes; > iova += bytes; > - page_offset = 0; > } static int rxe_mr_flush_pmem_iova(struct rxe_mr *mr, u64 iova, unsigned int length) { unsigned int page_offset; ... while (length > 0) { index = rxe_mr_iova_to_index(mr, iova); page = xa_load(&mr->page_list, index); page_offset = rxe_mr_iova_to_page_offset(mr, iova); ... page_offset = 0; } return 0; }> > return 0; > diff --git a/drivers/infiniband/sw/rxe/rxe_odp.c b/drivers/infiniband/sw/rxe/rxe_odp.c > index f58e3ec6252f..ae71812bea82 100644 > --- a/drivers/infiniband/sw/rxe/rxe_odp.c > +++ b/drivers/infiniband/sw/rxe/rxe_odp.c > @@ -358,7 +358,6 @@ int rxe_odp_flush_pmem_iova(struct rxe_mr *mr, u64 iova, > > length -= bytes; > iova += bytes; > - page_offset = 0; > } int rxe_odp_flush_pmem_iova(struct rxe_mr *mr, u64 iova, unsigned int length) { unsigned int page_offset; ... while (length > 0) { index = rxe_odp_iova_to_index(umem_odp, iova); page_offset = rxe_odp_iova_to_page_offset(umem_odp, iova); ... page_offset = 0; } mutex_unlock(&umem_odp->umem_mutex); return 0; } From the above, in the functions rxe_mr_flush_pmem_iova and rxe_odp_flush_pmem_iova, within the while loop, the variable page_offset is assigned a value. At the end of the loop, page_offset is set to 0. However, this assignment at the end of the loop is actually unnecessary. Thanks, Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev> Zhu Yanjun > > mutex_unlock(&umem_odp->umem_mutex); ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] RDMA/rxe: remove redundant assignment to variable page_offset 2025-10-14 12:03 [PATCH] RDMA/rxe: remove redundant assignment to variable page_offset Colin Ian King 2025-10-14 14:41 ` Zhu Yanjun @ 2025-10-19 12:06 ` Leon Romanovsky 1 sibling, 0 replies; 3+ messages in thread From: Leon Romanovsky @ 2025-10-19 12:06 UTC (permalink / raw) To: Zhu Yanjun, Jason Gunthorpe, linux-rdma, Colin Ian King Cc: kernel-janitors, linux-kernel On Tue, 14 Oct 2025 13:03:43 +0100, Colin Ian King wrote: > The variable page_offset is being assigned a value at the start of > a loop and being redundantly zero'd at the end of the loop, there > is no code that reads the zero'd value. The assignment is redundant > and can be removed. > > Applied, thanks! [1/1] RDMA/rxe: remove redundant assignment to variable page_offset https://git.kernel.org/rdma/rdma/c/1511efaca032ed Best regards, -- Leon Romanovsky <leon@kernel.org> ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-19 12:06 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-10-14 12:03 [PATCH] RDMA/rxe: remove redundant assignment to variable page_offset Colin Ian King 2025-10-14 14:41 ` Zhu Yanjun 2025-10-19 12:06 ` Leon Romanovsky
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox