By default Ctrl-P just jump back to the history while up arrow behave a little bit smarter.
For example if you have history like this
ssh a.comlscdssh b.comcatgrep
Normaly if you type
$ ssh and
Ctrl-P afterwares, it will give you
to change this behavior, you can put this in your .zshrc
bindkey "^P" up-line-or-beginning-searchbindkey "^N" down-line-or-beginning-search