mm: vmscan: If kswapd has been running too long, allow it to sleep

Under constant allocation pressure, kswapd can be in the situation where
sleeping_prematurely() will always return true even if kswapd has been
running a long time. Check if kswapd needs to be scheduled.

Signed-off-by: Mel Gorman <mgorman@suse.de>
HACK: selinux: Make sure valid sk->sk_security

 - check valid sk->sk_security pointer in sock_has_perm to avoid NULL
   pointer dereference.

Inspired by conversation on Security Enhanced Android developers'
mailing list:

http://comments.gmane.org/gmane.comp.security.seandroid/1110

Change-Id: I548a0a7f30b48d5bab7460ee4a9a69aa45600f0a
Signed-off-by: Hong-Mei Li <a21834@motorola.com>
Reviewed-on: http://gerrit.pcs.mot.com/574782
SLTApproved: Slta Waiver <sltawvr@motorola.com>
Tested-by: Jira Key <jirakey@motorola.com>
Reviewed-by: Check Patch <CHEKPACH@motorola.com>
Reviewed-by: Jeffrey Carlyle <jeff.carlyle@motorola.com>
Submit-Approved: Jira Key <jirakey@motorola.com>
Reviewed-on: http://gerrit.pcs.mot.com/576126