Most backpacking backpacks have both a big main compartment and a "brain" which goes over the top of the main compartment.
When packing, which gear should go into the brain?
The top pocket is a good place for things you don't expect to need, but must be quickly/easily accessible in extremis, by touch alone, without opening your sack: things you must be able to get at without soaking the rest of your stuff or losing it in a gale, and that you might need before you can find shelter.
In my top pocket, I usually have (when not on my person):
Beware that the top pocket is usually less waterproof than the main body, so consider using small drybags for the stuff you put there. Also, it's more exposed to impact, so some items may need protective cases.
As the other answers mention, the brain compartment usually ends up becoming the knick-knack / catch-all pocket, for small items items that get frequently used. There are, however, several caveats to be aware of:
Items in the brain tend to get knocked around a bit, whether from low hanging branches or flopping the top pocket over when accessing the main compartment. That this pocket is usually not filled to capacity exacerbates this issue as "contents may shift during flight."
While each of the individual items, such as electronics and snacks, might be light, these items are often quite dense. The cumulative mass of a phone/ gps/ map/ compass/ bars/ journal/ sunscreen/ first-aid kit/... can add up quickly, resulting in a pack that is severely top heavy. That contents in this pocket tend to shift can making for interesting moments when hiking through more adventurous terrain.
As an alternative philosophy, many large backpacks have features that allow for the quick conversion of the brain into a lumbar pack. If you're interested in exploring short side hikes off your main path, consider loading the brain as a self-sufficient day pack with food, water, and a couple layers. If the desire for side exploration strikes, you need only unclip the brain, stash your main pack in an animal (and human) friendly manner, and then go explore that side trail.
For example, I often like to go on backpacking trips with an aim towards fly fishing. As such, I store my fishing equipment (nippers, clamps, floatant, fly box, reel, ...) in the brain, along with a few necessities. If I spy an intriguing stretch of water, I then can quickly stash my main pack (pulling out and separately stashing my bear canister that has already been packed with any attractants) and then head to the water with just my rod and the brain from my pack, knowing that I'll have everything I need.
For another example, most backpacks built for climbing have a single main compartment and a brain. The main compartment tends to get wedged with cams and ropes and other climbing detritus, so the brain compartment gets loaded with everything that shouldn't get crushed (e.g., lunch, sunglasses, camera).
The basic rule of thumb is that your small, often accessed items should go into the brain of the backpack.
The idea is that if something goes into the main compartment it is much harder to access therefore the items that you are going to be using frequently should go into the brain of the pack.
Obviously, some of these things can be used enough to warrant moving them to pockets for even easier access, but most of the time, the brain is where they should be.
From an organizational standpoint, it also helps if you put things into the same compartments each time, to make it less likely that you will forget where you put something.