Skip to contentSkip to conversation

How to invalidate all cache

DISCUSSION Zheng Liu 4 participants 6 messages Oct 13, 2014 bcache (block layer cache)

lore
Share & tools
lore

Zheng Liu

author
#0 lore raw

Hi all,

I am trying to do some benchmarks against bcache, espeically in cache miss scenario, but I don't find a user interface to invalidate all cache. Anyone can tell me how to do that.

Thanks in advance,
- Zheng

#1 lore raw

You can try to detach the backing device, which will cause all dirty data to be written back, and attach it again.

Quoted 12 lines · Zheng Liu

Hi all,

I am trying to do some benchmarks against bcache, espeically in cache miss scenario, but I don't find a user interface to invalidate all cache. Anyone can tell me how to do that.

Thanks in advance,
- Zheng
--
To unsubscribe from this list: send the line "unsubscribe linux-bcache" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#2 lore raw

Hi Slava,

Thanks for your reply.

Quoted 2 lines · Slava Pestov

You can try to detach the backing device, which will cause all dirty data to be written back, and attach it again.

Yes, detaching a backing device will make all dirty data to be written back to the backing device. But if I understand correctly it couldn't invalidate all data in cache device. That means that after attaching backing device the data in cache device is still valid. All I want to do is to remove all data in cache device. Any idea?

Regards,
- Zheng

Quoted 14 lines · Zheng Liu
Quoted 12 lines

Hi all,

I am trying to do some benchmarks against bcache, espeically in cache miss scenario, but I don't find a user interface to invalidate all cache. Anyone can tell me how to do that.

Thanks in advance,
- Zheng
--
To unsubscribe from this list: send the line "unsubscribe linux-bcache" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

Hello Zheng,

Quoted 4 lines · you

Yes, detaching a backing device will make all dirty data to be written back to the backing device. But if I understand correctly it couldn't invalidate all data in cache device. That means that after attaching backing device the data in cache device is still valid.

It would be a bug if cached data were considered valid after detaching and re-attaching. Because while a cache device an a backing device were separated, data could be written to a backing device, this would possibly make data in a "disconnected" cache obsolete.

Pavel Goran

author
#4 lore raw
Quoted 9 lines · Pavel Goran

Hello Zheng,

Quoted 4 lines · you

Yes, detaching a backing device will make all dirty data to be written back to the backing device. But if I understand correctly it couldn't invalidate all data in cache device. That means that after attaching backing device the data in cache device is still valid.

Quoted 4 lines

It would be a bug if cached data were considered valid after detaching and re-attaching. Because while a cache device an a backing device were separated, data could be written to a backing device, this would possibly make data in a "disconnected" cache obsolete.

Ah, Thanks for pointing it out. I got it.

BTW, there is a bug when I tried to detach/attach a backing device. A patch has sent out to the mailing list. That would be great if some one can review it.

Regards,
- Zheng