nvdimm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Ocean He <oceanhehy@gmail.com>
To: dan.j.williams@intel.com, ross.zwisler@linux.intel.com,
	vishal.l.verma@intel.com, dave.jiang@intel.com
Cc: Ocean He <hehy1@lenovo.com>,
	linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org
Subject: [PATCH] libnvdimm, region_devs: stop NDD_ALIASING bit test if one test pass
Date: Sun, 19 Aug 2018 00:01:28 -0400	[thread overview]
Message-ID: <1534651288-30306-1-git-send-email-oceanhehy@gmail.com> (raw)

From: Ocean He <hehy1@lenovo.com>

There is no need to finish entire loop to execute NDD_ALIASING bit test
against every nvdimm->flags. In practice, all the nd_mapping->nvdimm
have the same flags.

Because the check of alias is "if (alias)" but not 
"if (alias == nd_region->ndr_mappings)", there is no function change while
just save a few cycles.  

Signed-off-by: Ocean He <hehy1@lenovo.com>
A test to check if all the nd_mapping->nvdimm have the same flags, using 
Lenovo ThinkSystem SR630 and 4.18-rc6.

# ipmctl show -dimm

DimmID  Capacity        HealthState     ActionRequired  LockState       FWVersion
0x0021  125.7 GiB       Healthy         0               Disabled
0x0121  125.7 GiB       Healthy         0               Disabled
0x1021  125.7 GiB       Healthy         0               Disabled
0x1121  125.7 GiB       Healthy         0               Disabled

# ipmctl create -f -goal -socket 0x0 PersistentMemoryType=AppDirect

# ipmctl create -f -goal -socket 0x1 PersistentMemoryType=AppDirect

# reboot, to make goal configuration take effect.

# ndctl create-namespace -r region0 -s 100m -t pmem -m fsdax

# ndctl create-namespace -r region1 -s 100m -t pmem -m fsdax

# reboot and find all the nd_mapping->nvdimm have the same flags.

 drivers/nvdimm/region_devs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
index ec3543b..fc3bc1c 100644
--- a/drivers/nvdimm/region_devs.c
+++ b/drivers/nvdimm/region_devs.c
@@ -234,8 +234,10 @@ int nd_region_to_nstype(struct nd_region *nd_region)
 			struct nd_mapping *nd_mapping = &nd_region->mapping[i];
 			struct nvdimm *nvdimm = nd_mapping->nvdimm;
-			if (test_bit(NDD_ALIASING, &nvdimm->flags))
+			if (test_bit(NDD_ALIASING, &nvdimm->flags)) {
+				break;
+			}
 		if (alias)

Linux-nvdimm mailing list

             reply	other threads:[~2018-08-19  4:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-19  4:01 Ocean He [this message]
2018-08-30 21:51 ` [PATCH] libnvdimm, region_devs: stop NDD_ALIASING bit test if one test pass Verma, Vishal L
2018-09-02 12:40   ` [External] " Ocean HY1 He

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1534651288-30306-1-git-send-email-oceanhehy@gmail.com \
    --to=oceanhehy@gmail.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=hehy1@lenovo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=ross.zwisler@linux.intel.com \
    --cc=vishal.l.verma@intel.com \


* 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;
as well as URLs for NNTP newsgroup(s).