2014-06-02 14:41:54

by Sebastian Ott

[permalink] [raw]
Subject: Re: [PATCH 1/1] drivers/s390/cio/qdio_main.c: replace shift loop by ilog2

Hello Fabian,

On Tue, 20 May 2014, Fabian Frederick wrote:
>
> This is untested.
>
> Cc: Sebastian Ott <[email protected]>
> Cc: Andrew Morton <[email protected]>
> Signed-off-by: Fabian Frederick <[email protected]>
> ---
> drivers/s390/cio/qdio_main.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
> index 77466c4..8bf9ec1 100644
> --- a/drivers/s390/cio/qdio_main.c
> +++ b/drivers/s390/cio/qdio_main.c
> @@ -411,15 +411,14 @@ static inline void qdio_stop_polling(struct qdio_q *q)
>
> static inline void account_sbals(struct qdio_q *q, int count)
> {
> - int pos = 0;
> + int pos;
>
> q->q_stats.nr_sbal_total += count;
> if (count == QDIO_MAX_BUFFERS_MASK) {
> q->q_stats.nr_sbals[7]++;
> return;
> }
> - while (count >>= 1)
> - pos++;
> + pos = ilog2(count);
> q->q_stats.nr_sbals[pos]++;
> }
>
> --
> 1.8.4.5
>
>

Could you please resend the patch with a better description plus
the change Joe suggested.

Thanks,
Sebastian


2014-06-02 18:19:12

by Fabian Frédérick

[permalink] [raw]
Subject: Re: [PATCH 1/1] drivers/s390/cio/qdio_main.c: replace shift loop by ilog2

On Mon, 2 Jun 2014 16:41:48 +0200 (CEST)
Sebastian Ott <[email protected]> wrote:

> Hello Fabian,
>
> On Tue, 20 May 2014, Fabian Frederick wrote:
> >
> > This is untested.
> >
> > Cc: Sebastian Ott <[email protected]>
> > Cc: Andrew Morton <[email protected]>
> > Signed-off-by: Fabian Frederick <[email protected]>
> > ---
> > drivers/s390/cio/qdio_main.c | 5 ++---
> > 1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
> > index 77466c4..8bf9ec1 100644
> > --- a/drivers/s390/cio/qdio_main.c
> > +++ b/drivers/s390/cio/qdio_main.c
> > @@ -411,15 +411,14 @@ static inline void qdio_stop_polling(struct qdio_q *q)
> >
> > static inline void account_sbals(struct qdio_q *q, int count)
> > {
> > - int pos = 0;
> > + int pos;
> >
> > q->q_stats.nr_sbal_total += count;
> > if (count == QDIO_MAX_BUFFERS_MASK) {
> > q->q_stats.nr_sbals[7]++;
> > return;
> > }
> > - while (count >>= 1)
> > - pos++;
> > + pos = ilog2(count);
> > q->q_stats.nr_sbals[pos]++;
> > }
> >
> > --
> > 1.8.4.5
> >
> >
>
> Could you please resend the patch with a better description plus
> the change Joe suggested.
>
> Thanks,
> Sebastian

Hello Sebastian,
Conclusion of that patch/thread was that callers guarantee count to be > 0

Joe suggested to have unsigned count. Is it what you're talking about ?

Regards,
Fabian

2014-06-03 07:41:09

by Sebastian Ott

[permalink] [raw]
Subject: Re: [PATCH 1/1] drivers/s390/cio/qdio_main.c: replace shift loop by ilog2

On Mon, 2 Jun 2014, Fabian Frederick wrote:
> On Mon, 2 Jun 2014 16:41:48 +0200 (CEST)
> Sebastian Ott <[email protected]> wrote:
>
> > Hello Fabian,
> >
> > On Tue, 20 May 2014, Fabian Frederick wrote:
> > >
> > > This is untested.
> > >
> > > Cc: Sebastian Ott <[email protected]>
> > > Cc: Andrew Morton <[email protected]>
> > > Signed-off-by: Fabian Frederick <[email protected]>
> > > ---
> > > drivers/s390/cio/qdio_main.c | 5 ++---
> > > 1 file changed, 2 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
> > > index 77466c4..8bf9ec1 100644
> > > --- a/drivers/s390/cio/qdio_main.c
> > > +++ b/drivers/s390/cio/qdio_main.c
> > > @@ -411,15 +411,14 @@ static inline void qdio_stop_polling(struct qdio_q *q)
> > >
> > > static inline void account_sbals(struct qdio_q *q, int count)
> > > {
> > > - int pos = 0;
> > > + int pos;
> > >
> > > q->q_stats.nr_sbal_total += count;
> > > if (count == QDIO_MAX_BUFFERS_MASK) {
> > > q->q_stats.nr_sbals[7]++;
> > > return;
> > > }
> > > - while (count >>= 1)
> > > - pos++;
> > > + pos = ilog2(count);
> > > q->q_stats.nr_sbals[pos]++;
> > > }
> > >
> > > --
> > > 1.8.4.5
> > >
> > >
> >
> > Could you please resend the patch with a better description plus
> > the change Joe suggested.
> >
> > Thanks,
> > Sebastian
>
> Hello Sebastian,
> Conclusion of that patch/thread was that callers guarantee count to be > 0

Correct.

> Joe suggested to have unsigned count. Is it what you're talking about ?

Yes.

Regards,
Sebastian