From: "Dilger, Andreas" <andreas.dilger@intel.com>
To: NeilBrown <neilb@suse.com>
Cc: "Drokin, Oleg" <oleg.drokin@intel.com>,
James Simmons <jsimmons@infradead.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
lkml <linux-kernel@vger.kernel.org>,
lustre <lustre-devel@lists.lustre.org>
Subject: Re: [PATCH 2/2] staging: lustre: disable preempt while sampling processor id.
Date: Tue, 19 Dec 2017 23:37:31 +0000 [thread overview]
Message-ID: <124DA88F-854D-41B0-9A3C-84AE37D4DD24@intel.com> (raw)
In-Reply-To: <151363810776.11899.1696679196545013564.stgit@noble>
On Dec 18, 2017, at 16:01, NeilBrown <neilb@suse.com> wrote:
>
> Calling smp_processor_id() without disabling preemption
> triggers a warning (if CONFIG_DEBUG_PREEMPT).
> I think the result of cfs_cpt_current() is only used as a hint for
> load balancing, rather than as a precise and stable indicator of
> the current CPU. So it doesn't need to be called with
> preemption disabled.
>
> So disable preemption inside cfs_cpt_current() to silence the warning.
>
> Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
> ---
> .../staging/lustre/lnet/libcfs/linux/linux-cpu.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c
> index d30650f8dcb4..ca8518b8a3e0 100644
> --- a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c
> +++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c
> @@ -517,19 +517,20 @@ EXPORT_SYMBOL(cfs_cpt_spread_node);
> int
> cfs_cpt_current(struct cfs_cpt_table *cptab, int remap)
> {
> - int cpu = smp_processor_id();
> - int cpt = cptab->ctb_cpu2cpt[cpu];
> + int cpu;
> + int cpt;
>
> - if (cpt < 0) {
> - if (!remap)
> - return cpt;
> + preempt_disable();
> + cpu = smp_processor_id();
> + cpt = cptab->ctb_cpu2cpt[cpu];
>
> + if (cpt < 0 && remap) {
> /* don't return negative value for safety of upper layer,
> * instead we shadow the unknown cpu to a valid partition ID
> */
> cpt = cpu % cptab->ctb_nparts;
> }
> -
> + preempt_enable();
> return cpt;
> }
> EXPORT_SYMBOL(cfs_cpt_current);
>
>
Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Intel Corporation
next prev parent reply other threads:[~2017-12-19 23:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-18 23:01 [PATCH SET 6: 0/2] staging: lustre: two miscellaneous patches NeilBrown
2017-12-18 23:01 ` [PATCH 2/2] staging: lustre: disable preempt while sampling processor id NeilBrown
2017-12-19 23:37 ` Dilger, Andreas [this message]
2017-12-18 23:01 ` [PATCH 1/2] staging: lustre: use strim instead of cfs_trimwhite NeilBrown
2017-12-19 23:38 ` Dilger, Andreas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=124DA88F-854D-41B0-9A3C-84AE37D4DD24@intel.com \
--to=andreas.dilger@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jsimmons@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lustre-devel@lists.lustre.org \
--cc=neilb@suse.com \
--cc=oleg.drokin@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®