scroll-margin

scroll-margin is a variable defined in `C source code'.
Its value is
0


Documentation:
Number of lines of margin at the top and bottom of a window.
Recenter the window whenever point gets within this many lines
of the top or bottom of the window.

You can customize this variable.