I now have some working code for my dirhash dynamic memory allocation Google Summer of Code project. It is currently being reviewed and needs further testing, but if you're feeling brave you can grab a patch against HEAD from my project page on the FreeBSD wiki.

What the new code does is add an event handler for vm_lowmem events. When one of these events happens, the kernel will try to delete dirhashes that have not been used for DH_RECLAIMAGE seconds. This is currently set to five seconds, but I have no idea if this will be an optimal time. A bit of benchmarking and testing will be necessary to sort that out. If all dirhashes have been used more recently than DH_RECLAIMAGE, instead the first unlocked dirhash on the TAILQ list used to keep track of them all will be deleted. Due to how the existing dirhash code organizes this list based on a scoring system, the first hash on the list should be a mix of the the least recently used and least frequently used.

If my code turns out to work as it should, then the default maximum memory for dirhash can be safely increased quite a bit. If the system has plenty of spare memory, then lots will be available for dirhashes. Then if the system becomes low on memory, some of this dirhash memory will automatically be freed up for use by whatever else needs it. Hopefully we'll see some performance improvements overall on systems with lots of memory that need to deal with large directories, but I haven't done the benchmarks yet.

Back Home in Stockholm

|

I returned home to Stockholm nearly two weeks ago, but haven't managed to find time to post anything since then. It's good to be home. I missed Emma a great deal and it has been wonderful to get to spend time with her again. The weather is quite nice, though we've had some humid and rainy days. I don't mind those so much though. The amount of sunlight is amazing! In the middle of the night the sky is still bright if you look north, and it's pretty much fully daylight here by around three in the morning.

I have a new apartment in Lappkärrsberget, or Lappis, a big student neighborhood north of Stockholm University. Yesterday was my second trip to Ikea to finish getting furniture for the new place. The room is a little smaller than the one I had previously, but much cheaper and quite cute. Emma and my good friend Heydar also live in Lappis so I can visit them or they me with just a couple of minutes walk instead of a 30-45 minute trip by bike or Tunnelbana. I have a road right out my window but it is usually fairly quiet, and there are lots of trees to look at. A bunch of cows have been brought in to a nearby field, so I get to listen to them mooing too! I'll take some pictures of the new apartment soon.

My sister and her husband came to visit from Washington DC shortly after I returned from SF. They spent a couple of days with me in Stockholm and that was pretty fun. They then went on to Helsinki, St. Petersburg, and Tallinn before they come back here in a sort of loop around the Baltic Sea. Emma and I are getting on the ferry to Tallinn tonight to meet up with them and we'll all come back to Stockholm together in a couple of days. I am excited for the trip. I love the big Baltic ferries/party boats. And I've never been to Estonia, nor did I ever even think about it before I came to Sweden.

Oh, yesterday I bought an iPhone, now that they are finally available legitimately in Sweden. It's quite cool, though it was annoying how I couldn't get iTunes to connect to Apple's servers for several hours yesterday to finish setting the thing up. I love new toys. I'm now locked into a two year abonnemang with Telia, so I guess I will be staying in Sweden for awhile!

Dirhash memory allocation update

|

The Summer of Code officially started a couple of weeks ago, so I've been getting started on my project. I've not written any actual code yet, but have been busy with other aspects of the project. First of all I have been reading a bit of documentation and code relevant to dirhash itself and FreeBSD memory management. I have a lot to learn, especially about the memory stuff. The two approaches I am looking at, mentioned in the USENIX paper by Ian Dowse and David Malone (my SoC mentor), are to either use the buffer cache for dirhash's memory so the VM can take care of providing memory as it is available, or to use a method for allocating memory where the kernel can signal for some to be freed in low memory situations, perhaps using the slab allocator.

I have also been learning a little bit about Perforce, the version control system used by FreeBSD for experimental projects. I have not used Perforce before this, and it is a bit different from the VCSs I've used before (CVS and Subversion). Also, I have done a bit of experimentation with the current dirhash implementation just to be sure that it can free memory it no longer needs. This was just a simple test where I created a directory with a couple of million entries, checked the vfs.ufs.dirhash_mem sysctl, removed the directory, then checked vfs.ufs.dirhash_mem again to make sure the memory used had decreased. It had. Finally, I sent off a brief proposal to do a talk about this project at EuroBSDCon 2008. Obviously I don't have much to create a talk with yet, but I should by the end of the summer. Plus, the second day of EuroBSDCon this year happens to fall on my birthday, and I think hanging out with fellow BSD nerds in France could be a fun birthday activity :)

The day after I arrived in San Francisco was Bay to Breakers, so I immediately had an opportunity to take a lot of photos. Here are some of them. I avoided photographing the many naked people there were wandering around, so those should all be safe for work. I also took a few other photos while walking and biking around the city. San Francisco is a pretty nice looking place.

View from Alamo Square University of San Francisco Street I'm living on SF City Hall

Then, today was the finals for the Eurovision song contest. I wish I could have been in Sweden watching it with Emma and some friends, but I could at least get a live stream of it over the Internet. It was pretty entertaining. Dima Bilan from Russia won, but I liked other songs better, like the one from Iceland's Euroband. Sweden's entry from Charlotte Perelli sadly did not do very well in the voting. My favorite though was Baila el Chiki Chiki from Rodolfo Chikilicuatre in Spain:

Very amusing song. None of these videos are from the actual final contest performances because I couldn't find those on youtube yet. The whole contest can be streamed though, like the finals here.

In San Francisco

|

Today I made the long journey from Stockholm to San Francisco. I was a day later than intended, because yesterday I overslept massively and missed my flight--something that I have been doing far too often lately. I am now extremely tired because I got up about twenty-five hours ago and have spent much of that time in transit.

I bought some duty free akvavit in Stockholm and they tried to take it away from me in London. The airport security guy at Heathrow told me that Sweden is not part of the EU, and thus booze I bought there was not eligible to be duty free. I argued with him that in fact Sweden absolutely is part of the EU. He ultimately talked to his manager and they decided to let me through with my tasty akvavit anyway. Very weird.

My new flat is quite nice. It is somewhat furnished, but I need to make an Ikea trip to get the stuff it doesn't have yet. That will also give me an opportunity to buy some Swedish food that I will no longer be able to find readily at supermarkets. I'm living in the inner Richmond, which is not a neighborhood I've lived in before, so I'm going to need to explore to figure out where stuff is. Also, I'd really like to find a bike to ride. It would be great to be able to ride to work rather than take the bus.

I already miss Emma and feel homesick for Sweden. Riding BART into the city I felt like I've seen everything before, but it's become kind of foreign. It is strange to return to one's own country and not feel like it is home anymore. But I expect that I'll be keeping myself very busy in the coming weeks so the homesickness shouldn't be too bad.

Trip to San Francisco

|

My employer is having me come over to the states for six weeks starting next month to do some extra work while I have time off from classes. I'll be in San Francisco from the 16th of May until the 28th of June. Get in touch with me if you want to hang out!

Google SoC Project

|

My Google Summer of Code Project has been approved! I am excited that I will be supported by Google to work on FreeBSD. It should be a fun time.

Switch to Movable Type

|

I've reworked my site once again. This time I'm using Movable Type to power everything. I've imported old entries I used to have on a now-defunct Typo powered blog, as well as more recent posts from my LiveJournal.

Norrland

|

Emma and I spent the last week in northern Sweden. We took the train (which was on time, comfortable, and from an easy-to-reach station, all unlike flying) to Härnösand, where she is from. From there we also took a day trip by car to Umeå. I had a nice time. I met her parents and some more of her friends. It was Easter so we used that as an excuse to eat lots of candy. Sadly the mild winter has affected norrland too, so there wasn't a lot of snow in Härnösand and Umeå, but there was certainly more than I've seen in Stockholm. It also got rather cold at times. I believe down to -14°C one night, which seems quite cold considering it is now spring. I took quite a few photos. Here are some of the ones I've uploaded to Flickr:

Bagarstuga Emma Hella handmade wooden skis Frozen sea

Air travel is so lame

|

Well, I'm not in Kiruna. Thursday night my friends and I made our way to Arlanda airport to catch a quick flight to Kiruna. The flight was delayed, and some time after our supposed new departure time, someone who worked for the airline came and told us that there was a problem with radar or the radio in Kiruna, so no planes could land. She gave no estimate on when we'd get to leave. Several hours passed. Someone else finally came out around midnight or so and told us that they would not be able to fly tonight, and there would be another plane that could take us at 6 o'clock the following morning. After some deliberation, Emma and I decided that sleeping in the airport and having our time in Kiruna cut down quite a bit was a bunch of bullshit, and we were going to go home. Heydar, Lisa, and Antoine all decided they'd stick it out and take the morning flight. Emma and I got the airline to remove our luggage from the plane, collected it, bid our friends farewell as they looked for some nice benches to sleep on for a few hours, and took a rather expensive taxi ride back home.

I am not at all fond of flying anymore. Being on planes itself can occasionally be fun despite the cramped conditions and unpleasant airplane air, but all the crap about getting to inconveniently located airports, going through check-in and security queues, waiting for delayed flights, etc. has become so old. I am thinking I should try to only resort to air travel when I'm going to other continents. Short flights are quick and usually cheaper than trains, but I don't think all this cheap air travel we have nowadays is really worth the other costs it brings about. The cost to passengers in the rather low quality of service airlines can afford to provide makes the experience of flying not fun, and with what must be very low profit margins I don't see how airlines can afford to properly pay their employees. The environmental impact of so much air travel can't be good, either.

I am disappointed that I am missing out on cross country skiing, riding a snowmobile to the ice hotel, and going for a little trip by dog sled. I wanted to see some real snow and aurora borealis and sit in a sauna. I guess this will all have to wait for next winter now. But, in a couple of days Emma and I are going to take another trip. We're going to be visiting Härnösand for about a week, the town she is from, and possibly taking a little day trip up to Umeå as well. These places are in norrland so there will probably be a little snow up there too, but not the huge amounts that there likely still is in Kiruna.

On an unrelated note, I am currently experimenting with growing a beard. It is very strange.

Archives