*/
#include "gnilnd.h"
+#include <linux/swap.h>
void
kgnilnd_setup_smsg_attr(gni_smsg_attr_t *smsg_attr)
* to memory exhaustion during massive reconnects during a network
* outage. Limit the amount of fma blocks to use by always keeping
* a percent of pages free initially set to 25% of total memory. */
- if (global_page_state(NR_FREE_PAGES) < kgnilnd_data.free_pages_limit) {
+ if (nr_free_pages() < kgnilnd_data.free_pages_limit) {
LCONSOLE_INFO("Exceeding free page limit of %ld. "
"Free pages available %ld\n",
kgnilnd_data.free_pages_limit,
- global_page_state(NR_FREE_PAGES));
+ nr_free_pages());
return -ENOMEM;
}
#endif
rc = kgnilnd_find_net(connreq->gncr_dstnid, &net);
if (rc == -ESHUTDOWN) {
- CERROR("Looking up network: device is in shutdown");
+ CERROR("Looking up network: device is in shutdown\n");
return rc;
} else if (rc == -ENONET) {
CERROR("Connection data from %s: she sent "
RETURN(did_something);
}
+struct kgnilnd_dgram_timer {
+ struct timer_list timer;
+ kgn_device_t *dev;
+};
+
static void
-kgnilnd_dgram_poke_with_stick(unsigned long arg)
+kgnilnd_dgram_poke_with_stick(cfs_timer_cb_arg_t arg)
{
- int dev_id = arg;
- kgn_device_t *dev = &kgnilnd_data.kgn_devices[dev_id];
+ struct kgnilnd_dgram_timer *t = cfs_from_timer(t, arg, timer);
- wake_up(&dev->gnd_dgram_waitq);
+ wake_up(&t->dev->gnd_dgram_waitq);
}
/* use single thread for dgrams - should be sufficient for performance */
int rc, did_something;
unsigned long next_purge_check = jiffies - 1;
unsigned long timeout;
- struct timer_list timer;
- unsigned long deadline = 0;
+ struct kgnilnd_dgram_timer timer;
+ unsigned long deadline = 0;
DEFINE_WAIT(wait);
snprintf(name, sizeof(name), "kgnilnd_dg_%02d", dev->gnd_id);
prepare_to_wait(&dev->gnd_dgram_waitq, &wait, TASK_INTERRUPTIBLE);
- setup_timer(&timer, kgnilnd_dgram_poke_with_stick, dev->gnd_id);
- mod_timer(&timer, (long) jiffies + timeout);
+ cfs_timer_setup(&timer.timer,
+ kgnilnd_dgram_poke_with_stick,
+ dev, 0);
+ timer.dev = dev;
+ mod_timer(&timer.timer, (long) jiffies + timeout);
/* last second chance for others to poke us */
did_something += xchg(&dev->gnd_dgram_ready, GNILND_DGRAM_IDLE);
deadline = jiffies + cfs_time_seconds(*kgnilnd_tunables.kgn_dgram_timeout);
}
- del_singleshot_timer_sync(&timer);
+ del_singleshot_timer_sync(&timer.timer);
finish_wait(&dev->gnd_dgram_waitq, &wait);
}