All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lib: dynamic_queue_limits: use memset and offsetof init
@ 2021-01-15  1:50 Yejune Deng
       [not found] ` <202101151210.n0rr01he-lkp@intel.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Yejune Deng @ 2021-01-15  1:50 UTC (permalink / raw)
  To: rdunlap, yejune.deng, akpm; +Cc: linux-kernel

In dql_reset(), use memset and offsetof instead of '= 0'.

Signed-off-by: Yejune Deng <yejune.deng@gmail.com>
---
 lib/dynamic_queue_limits.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/lib/dynamic_queue_limits.c b/lib/dynamic_queue_limits.c
index fde0aa2..21f0745 100644
--- a/lib/dynamic_queue_limits.c
+++ b/lib/dynamic_queue_limits.c
@@ -116,13 +116,7 @@ void dql_completed(struct dql *dql, unsigned int count)
 void dql_reset(struct dql *dql)
 {
 	/* Reset all dynamic values */
-	dql->limit = 0;
-	dql->num_queued = 0;
-	dql->num_completed = 0;
-	dql->last_obj_cnt = 0;
-	dql->prev_num_queued = 0;
-	dql->prev_last_obj_cnt = 0;
-	dql->prev_ovlimit = 0;
+	memset(dql, 0, offsetof(struct dql, lowest_slack));
 	dql->lowest_slack = UINT_MAX;
 	dql->slack_start_time = jiffies;
 }
-- 
1.9.1


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

* Re: [PATCH] lib: dynamic_queue_limits: use memset and offsetof init
       [not found] ` <202101151210.n0rr01he-lkp@intel.com>
@ 2021-01-15  6:33   ` Yejune Deng
  2021-01-16  0:53     ` Yejune Deng
  0 siblings, 1 reply; 3+ messages in thread
From: Yejune Deng @ 2021-01-15  6:33 UTC (permalink / raw)
  To: kernel test robot; +Cc: rdunlap, akpm, kbuild-all, Linux Kernel Mailing List

My patch is applied to linux-next/master tree.I also built in arch
arm64 and x86_64,is OK.Is something wrong with that?

On Fri, Jan 15, 2021 at 12:45 PM kernel test robot <lkp@intel.com> wrote:
>
> Hi Yejune,
>
> Thank you for the patch! Yet something to improve:
>
> [auto build test ERROR on linus/master]
> [also build test ERROR on v5.11-rc3 next-20210114]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
>
> url:    https://github.com/0day-ci/linux/commits/Yejune-Deng/lib-dynamic_queue_limits-use-memset-and-offsetof-init/20210115-112707
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 146620506274bd24d52fb1c589110a30eed8240b
> config: nds32-randconfig-m031-20210115 (attached as .config)
> compiler: nds32le-linux-gcc (GCC) 9.3.0
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # https://github.com/0day-ci/linux/commit/9be25b076f67d15d29016cb613b95d2ae190a9b4
>         git remote add linux-review https://github.com/0day-ci/linux
>         git fetch --no-tags linux-review Yejune-Deng/lib-dynamic_queue_limits-use-memset-and-offsetof-init/20210115-112707
>         git checkout 9be25b076f67d15d29016cb613b95d2ae190a9b4
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nds32
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
> All error/warnings (new ones prefixed by >>):
>
>    lib/dynamic_queue_limits.c: In function 'dql_reset':
> >> lib/dynamic_queue_limits.c:119:2: error: implicit declaration of function 'memset' [-Werror=implicit-function-declaration]
>      119 |  memset(dql, 0, offsetof(struct dql, lowest_slack));
>          |  ^~~~~~
> >> lib/dynamic_queue_limits.c:119:2: warning: incompatible implicit declaration of built-in function 'memset'
>    lib/dynamic_queue_limits.c:11:1: note: include '<string.h>' or provide a declaration of 'memset'
>       10 | #include <linux/dynamic_queue_limits.h>
>      +++ |+#include <string.h>
>       11 | #include <linux/compiler.h>
>    cc1: some warnings being treated as errors
>
>
> vim +/memset +119 lib/dynamic_queue_limits.c
>
>    115
>    116  void dql_reset(struct dql *dql)
>    117  {
>    118          /* Reset all dynamic values */
>  > 119          memset(dql, 0, offsetof(struct dql, lowest_slack));
>    120          dql->lowest_slack = UINT_MAX;
>    121          dql->slack_start_time = jiffies;
>    122  }
>    123  EXPORT_SYMBOL(dql_reset);
>    124
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

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

* Re: [PATCH] lib: dynamic_queue_limits: use memset and offsetof init
  2021-01-15  6:33   ` Yejune Deng
@ 2021-01-16  0:53     ` Yejune Deng
  0 siblings, 0 replies; 3+ messages in thread
From: Yejune Deng @ 2021-01-16  0:53 UTC (permalink / raw)
  To: kernel test robot
  Cc: rdunlap, akpm, kbuild-all, Linux Kernel Mailing List, nickhu,
	green.hu, deanbo422

Sorry.It failed in ARCH nds32,I will fix it in the next submit.


On Fri, Jan 15, 2021 at 2:33 PM Yejune Deng <yejune.deng@gmail.com> wrote:
>
> My patch is applied to linux-next/master tree.I also built in arch
> arm64 and x86_64,is OK.Is something wrong with that?
>
> On Fri, Jan 15, 2021 at 12:45 PM kernel test robot <lkp@intel.com> wrote:
> >
> > Hi Yejune,
> >
> > Thank you for the patch! Yet something to improve:
> >
> > [auto build test ERROR on linus/master]
> > [also build test ERROR on v5.11-rc3 next-20210114]
> > [If your patch is applied to the wrong git tree, kindly drop us a note.
> > And when submitting patch, we suggest to use '--base' as documented in
> > https://git-scm.com/docs/git-format-patch]
> >
> > url:    https://github.com/0day-ci/linux/commits/Yejune-Deng/lib-dynamic_queue_limits-use-memset-and-offsetof-init/20210115-112707
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 146620506274bd24d52fb1c589110a30eed8240b
> > config: nds32-randconfig-m031-20210115 (attached as .config)
> > compiler: nds32le-linux-gcc (GCC) 9.3.0
> > reproduce (this is a W=1 build):
> >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         # https://github.com/0day-ci/linux/commit/9be25b076f67d15d29016cb613b95d2ae190a9b4
> >         git remote add linux-review https://github.com/0day-ci/linux
> >         git fetch --no-tags linux-review Yejune-Deng/lib-dynamic_queue_limits-use-memset-and-offsetof-init/20210115-112707
> >         git checkout 9be25b076f67d15d29016cb613b95d2ae190a9b4
> >         # save the attached .config to linux build tree
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nds32
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> >
> > All error/warnings (new ones prefixed by >>):
> >
> >    lib/dynamic_queue_limits.c: In function 'dql_reset':
> > >> lib/dynamic_queue_limits.c:119:2: error: implicit declaration of function 'memset' [-Werror=implicit-function-declaration]
> >      119 |  memset(dql, 0, offsetof(struct dql, lowest_slack));
> >          |  ^~~~~~
> > >> lib/dynamic_queue_limits.c:119:2: warning: incompatible implicit declaration of built-in function 'memset'
> >    lib/dynamic_queue_limits.c:11:1: note: include '<string.h>' or provide a declaration of 'memset'
> >       10 | #include <linux/dynamic_queue_limits.h>
> >      +++ |+#include <string.h>
> >       11 | #include <linux/compiler.h>
> >    cc1: some warnings being treated as errors
> >
> >
> > vim +/memset +119 lib/dynamic_queue_limits.c
> >
> >    115
> >    116  void dql_reset(struct dql *dql)
> >    117  {
> >    118          /* Reset all dynamic values */
> >  > 119          memset(dql, 0, offsetof(struct dql, lowest_slack));
> >    120          dql->lowest_slack = UINT_MAX;
> >    121          dql->slack_start_time = jiffies;
> >    122  }
> >    123  EXPORT_SYMBOL(dql_reset);
> >    124
> >
> > ---
> > 0-DAY CI Kernel Test Service, Intel Corporation
> > https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

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

end of thread, other threads:[~2021-01-16  0:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-15  1:50 [PATCH] lib: dynamic_queue_limits: use memset and offsetof init Yejune Deng
     [not found] ` <202101151210.n0rr01he-lkp@intel.com>
2021-01-15  6:33   ` Yejune Deng
2021-01-16  0:53     ` Yejune Deng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.